file transfer to watchkit failed - No such file or directory

I'm trying to transfer a file from iOS app to watchkit. I checked WCSessionDelegate calls are working well. But, interestingly, file url does not exist.

Per the code below, I get fileURL from the argument, and the argument value is wrong somehow. When I search for the directory from Mac Finder, the directory doesn't exist. Do you have any idea?


func session(session: WCSession, didReceiveFile file: WCSessionFile) {

print(file.fileURL)

let baseUrl = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("group.com.ABC.WatchAac")

....

}


copy error=========Error Domain=NSCocoaErrorDomain Code=4 "“audio9.caf” couldn’t be moved to “35B1C*******9-B6BF-A6A97154724C” because either the former doesn't exist, or the folder containing the ln't exist." UserInfo=0x79079700 {NSSourceFilePathErrorKey=/Users/AAA/Library/Developer/CoreSimulator/Devices/62C8**********4-82A1C0626A31/data/Containers/Data/PluginKitPlugin/25063************-8BD68ECEB831/Documents/Inbox/com.apple.watchconnectivity/Files/35B1*******9-B6BF-A6A97154724C/audio9.caf, NSUserStringVariant=(

Move

), NSFilePath=/Users/AAA/Library/Developer/CoreSimulator/Devices/62C8******-82A1C0626A31/data/Containers/Data/PluginKitPlugin/25063********6C-8BD68ECEB831/Documents/Inbox/com.apple.watchconnectivity/Files/35B************-A6A97154724C/audio9.caf, NSDestinationFilePath=/Users/AAA/Library/Developer/CoreSimulator/Devices/62C*******-82A1C0626A31/data/Containers/Shared/AppGroup/87CC*********-972F-8DD9689568E3/file:///Users/AAA/Library/Developer/CoreSimulator/Devices/62C88********-82A1C0626A31/data/Containers/Data/PluginKitPlugin/250*********-A46C-8BD68ECEB831/Documents/Inbox/com.apple.watchconnectivity/Files/35B1*********-A6A97154724C/audio9.caf, NSUnderlyingError=0x79079620 "The operation couldn’t be completed. No such file or directory"}

Accepted Answer

I believe you are hitting a now known bug in Seed 1 which will be fixed in the next seed. You are most likely receiving a file from an old "build and run" session When you hit the play/run button in Xcode it builds and installs a new version of your app, which is what I mean by a "build and run" session.


Any files transferred after both apps have been installed should work fine. To avoid hitting this you could either manually launch the app on the device, or just tell Xcode to just run the app (not "build and run"; you can do this by holding down ctrl while hitting the "play" button in Xcode).

file transfer to watchkit failed - No such file or directory
 
 
Q