This code is in the shared file that works when I run it as app, but when I run it as AppClip it is not working. Running on the simulator is working even as AppClip.
Here is the code (pretty trivial):
Code Block let session = URLSession.shared let url = URL(string: "https://learnappmaking.com/ex/users.json")! let task = session.dataTask(with: url, completionHandler: { _, response, error in print(error) print(response) }) task.resume()
I am getting this error:
Code Block 2020-11-20 19:35:05.189273+0100 ExampleAppClip[14703:4633304] [Client] Updating selectors after delegate removal failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 92 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service on pid 92 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.} 2020-11-20 19:35:05.363730+0100 ExampleAppClip[14703:4633299] [connection] nw_socket_connect [C1.1:3] connectx(8 (guarded), [srcif=0, srcaddr=<NULL>, dstaddr=104.27.132.57:443], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [65: No route to host] 2020-11-20 19:35:05.364100+0100 ExampleAppClip[14703:4633299] [connection] nw_socket_connect [C1.1:3] connectx failed (fd 8) [65: No route to host] 2020-11-20 19:35:05.364195+0100 ExampleAppClip[14703:4633299] [] nw_socket_connect connectx failed [65: No route to host] 2020-11-20 19:35:05.368229+0100 ExampleAppClip[14703:4633299] [connection] nw_socket_connect [C1.2:3] connectx(8 (guarded), [srcif=0, srcaddr=<NULL>, dstaddr=104.27.133.57:443], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [65: No route to host] 2020-11-20 19:35:05.368424+0100 ExampleAppClip[14703:4633299] [connection] nw_socket_connect [C1.2:3] connectx failed (fd 8) [65: No route to host] 2020-11-20 19:35:05.368484+0100 ExampleAppClip[14703:4633299] [] nw_socket_connect connectx failed [65: No route to host] 2020-11-20 19:35:05.370781+0100 ExampleAppClip[14703:4633299] [connection] nw_socket_connect [C1.3:3] connectx(8 (guarded), [srcif=0, srcaddr=<NULL>, dstaddr=172.67.210.249:443], SAE_ASSOCID_ANY, 0, NULL, 0, NULL, SAE_CONNID_ANY) failed: [65: No route to host] 2020-11-20 19:35:05.370989+0100 ExampleAppClip[14703:4633299] [connection] nw_socket_connect [C1.3:3] connectx failed (fd 8) [65: No route to host] 2020-11-20 19:35:05.371054+0100 ExampleAppClip[14703:4633299] [] nw_socket_connect connectx failed [65: No route to host] 2020-11-20 19:35:05.372142+0100 ExampleAppClip[14703:4633299] Connection 1: received failure notification 2020-11-20 19:35:05.372241+0100 ExampleAppClip[14703:4633299] Connection 1: failed to connect 1:65, reason -1 2020-11-20 19:35:05.372291+0100 ExampleAppClip[14703:4633299] Connection 1: encountered error(1:65) 2020-11-20 19:35:05.374764+0100 ExampleAppClip[14703:4633300] Task <3C72DFED-F839-4BD2-9FE2-CC0B8BB7090F>.<1> HTTP load failed, 0/0 bytes (error code: -1004 [1:65]) 2020-11-20 19:35:05.383016+0100 ExampleAppClip[14703:4633299] Task <3C72DFED-F839-4BD2-9FE2-CC0B8BB7090F>.<1> finished with error [-1004] Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=65, NSUnderlyingError=0x282ecc5a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=65, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3C72DFED-F839-4BD2-9FE2-CC0B8BB7090F>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <3C72DFED-F839-4BD2-9FE2-CC0B8BB7090F>.<1>" ), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=https://learnappmaking.com/ex/users.json, NSErrorFailingURLKey=https://learnappmaking.com/ex/users.json, _kCFStreamErrorDomainKey=1} Optional(Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo={_kCFStreamErrorCodeKey=65, NSUnderlyingError=0x282ecc5a0 {Error Domain=kCFErrorDomainCFNetwork Code=-1004 "(null)" UserInfo={_kCFStreamErrorCodeKey=65, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <3C72DFED-F839-4BD2-9FE2-CC0B8BB7090F>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <3C72DFED-F839-4BD2-9FE2-CC0B8BB7090F>.<1>" ), NSLocalizedDescription=Could not connect to the server., NSErrorFailingURLStringKey=https://learnappmaking.com/ex/users.json, NSErrorFailingURLKey=https://learnappmaking.com/ex/users.json, _kCFStreamErrorDomainKey=1}) nil