I Am Trying To Log Touch Coordinat… | Apple Developer Forums

  • Global Nav Open Menu Global Nav Close Menu
  • Apple Developer
Search
  • Apple Developer
  • News
  • Discover
  • Design
  • Develop
  • Distribute
  • Support
  • Account
Only search within “”

Quick Links

5 Quick Links Developer Forums Search for a topic, subtopic, or tag Clear search query Local Nav Open Menu Local Nav Close Menu
  • Search
Post Profile
  • Sign in
  • Create account
I am trying to log touch coordinates into the CSV file, but I am getting "No exact matches in call to initializer" error Programming Languages Swift Swift You’re now watching this thread. If you’ve opted in to email or web notifications, you’ll be notified when there’s activity. Click again to stop watching or visit your profile to manage watched threads and notifications. You’ve stopped watching this thread and will no longer receive emails or web notifications when there’s activity. Click again to start watching. anupreetttt OP Created Jun ’22 Replies 1 Boosts 0 Views 676 Participants 2

I am trying to log touch coordinates into the CSV file, but I am getting "No exact matches in call to initializer" error. I need to parse the touch coordinates as String. What is going wrong here?

  super.touchesBegan(touches , with: event)     let touch = touches.first!     let location = touch.location(in: view) //Returns the current location of the receiver in the coordinate system.     let mylocation = String(location) ***No exact matches in call to initializer        //    print("touches began \(location)")           let fileName2 = "testing2.csv" // CSV filename           let documentDirectoryPath2 = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0] as String           let documentURL2 = URL(fileURLWithPath: documentDirectoryPath2).appendingPathComponent(fileName2)           let output2 = OutputStream.toMemory() // stream data into memory     let csvWriter2 = CHCSVWriter(outputStream: output2,                   encoding: String.Encoding.utf8.rawValue, delimiter: unichar(",".utf8.first!))           csvWriter2?.writeField("Timestamp")     csvWriter2?.writeField("Timestamp in miliseconds")     csvWriter2?.finishLine()           //Array to add data       var arrOfTimestamp = [[String]]()   //    var arrOfTimeInMiliSec = [[Int]]()              arrOfTimestamp.append([mylocation])   //    arrOfTimeInMiliSec.append([time])       for(elements) in arrOfTimestamp.enumerated() {         csvWriter2?.writeField(elements.element[0])       }       csvWriter2?.closeStream()       let buffer = (output2.property(forKey: .dataWrittenToMemoryStreamKey) as? Data)!       do{         try buffer.write(to: documentURL2)       }       catch {       } Boost Copy to clipboard Share this post Copied to Clipboard Replies 1 Boosts 0 Views 676 Participants 2 robnotyou OP Jun ’22

Instead of:

let mylocation = String(location)

Try:

let mylocation = String("\(location.x),\(location.y)") 0 comments 0 Copy to clipboard Share this post Copied to Clipboard Load more Add comment I am trying to log touch coordinates into the CSV file, but I am getting "No exact matches in call to initializer" error First post date Last post date Q

Tag » App Storage No Exact Matches In Call To Initializer