Hi All,
I have implemented a system for transfering files from an Apple Watch app to the host iOS app. Below is the Apple Watch code that succeeds:
- (void)sendAudioAtURL:(NSURL *)audioURL
{
if ([WCSession isSupported] && [audioURL checkResourceIsReachableAndReturnError:nil]) {
[[WCSession defaultSession] transferFile:audioURL metadata:nil];
}
}
- (void)session:(WCSession *)session didFinishFileTransfer:(WCSessionFileTransfer *)fileTransfer error:(nullable NSError *)error
{
NSLog(@"Finished file transfer: %@ error: %@", fileTransfer, error);
[[NSFileManager defaultManager] removeItemAtURL:fileTransfer.file.fileURL error:nil];
}When I debug against the Apple Watch, I see didFinishFileTransfer method being called with no error. The issue is, in my iOS app, despite the fact that I activate my session on startup, the received transfer delegate callback never occurs:
- (void)configureWatchConnectivity
{
if ([WCSession isSupported]) {
CLS_LOG(@"Configuring WCSession...");
[WCSession defaultSession].delegate = self;
[[WCSession defaultSession] activateSession];
}
}
- (void)session:(WCSession *)session didReceiveFile:(WCSessionFile *)file
{
// NEVER CALLED
}Has anyone successfullly transfered a file via WCSession from Apple Watch -> iPhone? If so, would you mind sharing how you did it?
Thanks!