Does PDFKit work within AppClips?

PDFKit works fine with the iOS 14 app.
But when I display the same ViewController inside AppClips, the PDF is not displayed.
( I checked Clips Target Membership. )
Is there any solution?

Accepted Reply

I Solved it.

PDFDocument(url: URL) does not work in App Clip. It returns nil.
https://developer.apple.com/documentation/app_clips/choosing_the_right_functionality_for_your_app_clip

Code Block language
(lldb) po PDFDocument(url: pdfURL)
2020-09-10 23:45:06.298773+0900 DemoAppClips[3140:268982] [connection] nw_socket_connect [C1.1:1] connectx(9, [srcif=0, srcaddr=<NULL>, dstaddr=160.16.90.46:443], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [65: No route to host]
2020-09-10 23:45:06.299306+0900 DemoAppClips[3140:268982] [connection] nw_socket_connect [C1.1:1] connectx failed (fd 9) [65: No route to host]
2020-09-10 23:45:06.299517+0900 DemoAppClips[3140:268982] [] nw_socket_connect connectx failed [65: No route to host]
2020-09-10 23:45:06.301036+0900 DemoAppClips[3140:268987] [connection] nw_connection_get_connected_socket [C1] Client called nw_connection_get_connected_socket on unconnected nw_connection
2020-09-10 23:45:06.301237+0900 DemoAppClips[3140:268987] TCP Conn 0x2832d00b0 Failed : error 0:65 [65]
nil


So, I used URLSession to download the PDF data to a local file temporarily.

I hope this will help :)

Replies

I Solved it.

PDFDocument(url: URL) does not work in App Clip. It returns nil.
https://developer.apple.com/documentation/app_clips/choosing_the_right_functionality_for_your_app_clip

Code Block language
(lldb) po PDFDocument(url: pdfURL)
2020-09-10 23:45:06.298773+0900 DemoAppClips[3140:268982] [connection] nw_socket_connect [C1.1:1] connectx(9, [srcif=0, srcaddr=<NULL>, dstaddr=160.16.90.46:443], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [65: No route to host]
2020-09-10 23:45:06.299306+0900 DemoAppClips[3140:268982] [connection] nw_socket_connect [C1.1:1] connectx failed (fd 9) [65: No route to host]
2020-09-10 23:45:06.299517+0900 DemoAppClips[3140:268982] [] nw_socket_connect connectx failed [65: No route to host]
2020-09-10 23:45:06.301036+0900 DemoAppClips[3140:268987] [connection] nw_connection_get_connected_socket [C1] Client called nw_connection_get_connected_socket on unconnected nw_connection
2020-09-10 23:45:06.301237+0900 DemoAppClips[3140:268987] TCP Conn 0x2832d00b0 Failed : error 0:65 [65]
nil


So, I used URLSession to download the PDF data to a local file temporarily.

I hope this will help :)