Monday, June 3, 2024
HomeiOS DevelopmentDownside transfering file from WatchOS to iOS (iPhone) utilizing WCSessionFileTransfer

Downside transfering file from WatchOS to iOS (iPhone) utilizing WCSessionFileTransfer


I’m utilizing WCSessionFileTransfer for transferring some information from WatchOS (10.5) to iPhone iOS 17.5.1

let session: WCSession = WCSession.default
session.delegate = self
session.activate()
...
...
...
fileTransfer = session.transferFile(file.url, metadata: ["alternateId" : file.alternateId, "type" : file.type])

The next delegate handles the file transferring outcome

func session(_ session: WCSession, didFinish fileTransfer: WCSessionFileTransfer, error: Error?) { 
...
...
...
}

The issue is that generally the didFinish response from WCSessionDelegate doesn’t fireplace in any respect.

Attaching the debug console I used to be in a position to retrieve the next error:

[WCFileStorage persistOutgoingFileTransfer:] error serializing file
switch <WCSessionFileTransfer: 0x300155d60, session file:
<WCSessionFile: 0x3001575c0, identifier:
0C8857EC-7D74-4E78-BA28-6C5526DE8949, file:
FILE.EXT,
hasMetadata: YES>, transferring: YES> because of Error
Area=NSCocoaErrorDomain Code=4866 “Caught exception throughout archival:
This object might solely be encoded by an NSXPCCoder. ( 0 CoreFoundation
0x000000019b064f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460 1
libobjc.A.dylib 0x0000000192ef6018 objc_exception_throw + 60 2
Basis 0x0000000199fe7778 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
1419128 3 Basis 0x0000000199ea0e14
3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 4 WatchConnectivity
0x000000021d055f60 1AB4DDD6-9238-3965-B744-819F2916C8CC + 126816 5
Basis 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
81428 6 WatchConnectivity 0x000000021d0567f0
1AB4DDD6-9238-3965-B744-819F2916C8CC + 129008 7 Basis
0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 8
Basis 0x0000000199f30628 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
669224 9 WatchConnectivity 0x000000021d0583ac
1AB4DDD6-9238-3965-B744-819F2916C8CC + 136108 10 WatchConnectivity
0x000000021d04390c 1AB4DDD6-9238-3965-B744-819F2916C8CC + 51468 11
WatchConnectivity 0x000000021d046640
1AB4DDD6-9238-3965-B744-819F2916C8CC + 63040 12 Basis
0x0000000199ea9be0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117728 13
Basis 0x0000000199ea9aa0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
117408 14 Basis 0x0000000199ea98a0
3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 116896 15 Basis
0x0000000199ea7b40 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 109376 16
Basis 0x0000000199f2c558 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
652632 17 Basis 0x0000000199f2c1a4
3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 651684 18 libdispatch.dylib
0x0000000105ed7764 _dispatch_block_async_invoke2 + 148 19
libdispatch.dylib 0x0000000105ec67bc _dispatch_client_callout + 20 20
libdispatch.dylib 0x0000000105ec98e0 _dispatch_continuation_pop + 676
21 libdispatch.dylib 0x0000000105ec8bb8
_dispatch_async_redirect_invoke + 680 22 libdispatch.dylib 0x0000000105edaae4 _dispatch_root_queue_drain + 404 23
libdispatch.dylib 0x0000000105edb4d8 _dispatch_worker_thread2 + 188 24
libsystem_pthread.dylib 0x00000001f7ebb8f8 _pthread_wqthread + 228 25
libsystem_pthread.dylib 0x00000001f7eb80cc start_wqthread + 8 )”
UserInfo={NSDebugDescription=Caught exception throughout archival: This
object might solely be encoded by an NSXPCCoder. ( 0 CoreFoundation
0x000000019b064f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460 1
libobjc.A.dylib 0x0000000192ef6018 objc_exception_throw + 60 2
Basis 0x0000000199fe7778 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
1419128 3 Basis 0x0000000199ea0e14
3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 4 WatchConnectivity
0x000000021d055f60 1AB4DDD6-9238-3965-B744-819F2916C8CC + 126816 5
Basis 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
81428 6 WatchConnectivity 0x000000021d0567f0
1AB4DDD6-9238-3965-B744-819F2916C8CC + 129008 7 Basis
0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 8
Basis 0x0000000199f30628 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
669224 9 WatchConnectivity 0x000000021d0583ac
1AB4DDD6-9238-3965-B744-819F2916C8CC + 136108 10 WatchConnectivity
0x000000021d04390c 1AB4DDD6-9238-3965-B744-819F2916C8CC + 51468 11
WatchConnectivity 0x000000021d046640
1AB4DDD6-9238-3965-B744-819F2916C8CC + 63040 12 Basis
0x0000000199ea9be0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117728 13
Basis 0x0000000199ea9aa0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
117408 14 Basis 0x0000000199ea98a0
3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 116896 15 Basis
0x0000000199ea7b40 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 109376 16
Basis 0x0000000199f2c558 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 +
652632 17 Basis 0x0000000199f2c1a4
3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 651684 18 libdispatch.dylib
0x0000000105ed7764 _dispatch_block_async_invoke2 + 148 19
libdispatch.dylib 0x0000000105ec67bc _dispatch_client_callout + 20 20
libdispatch.dylib 0x0000000105ec98e0 _dispatch_continuation_pop + 676
21 libdispatch.dylib 0x0000000105ec8bb8
_dispatch_async_redirect_invoke + 680 22 libdispatch.dylib 0x0000000105edaae4 _dispatch_root_queue_drain + 404 23
libdispatch.dylib 0x0000000105edb4d8 _dispatch_worker_thread2 + 188 24
libsystem_pthread.dylib 0x00000001f7ebb8f8 _pthread_wqthread + 228 25
libsystem_pthread.dylib 0x00000001f7eb80cc start_wqthread + 8 )}

Sadly this error just isn’t forwarded to WCSessionDelegate

The error appears associated to NSXPCCoder however I don’t discover any particular documentation about it.

NSCocoaErrorDomain Code=4866 “Caught exception throughout archival: This
object might solely be encoded by an NSXPCCoder.

Am I doing one thing improper? How do I deal with this kind of error? Is there a selected restrict to the file that may be transferred utilizing WCSessionFileTransfer?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments