We are using deep links to complete verification for an app we're working on. Said deep links cause the app delegate method:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
To be called. This app is using React Native, using the in-build Linking
API. Some of the time making a network request when we get the Linking
callback works, but sometimes we get a networking error:
Task <D47D1F90-E2D1-4AB7-8706-8737B68CC5E8>.<180> finished with error [-1005] Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=53, NSUnderlyingError=0x283352ac0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x281ed9130 [0x1e9babcb0]>{length = 16, capacity = 16, bytes = 0x100201bb34d2847e0000000000000000}, _kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <D47D1F90-E2D1-4AB7-8706-8737B68CC5E8>.<180>, _NSURLErrorRelatedURLSessionTaskErrorKey=("LocalDataTask <D47D1F90-E2D1-4AB7-8706-8737B68CC5E8>.<180>"
I've had a pretty extensive google and it seems to be suggested that this can be caused when a network request is made in the background, however Apple quite clearly state in the docs for this method:
If a URL arrives while your app is suspended or running in the background, the system moves your app to the foreground prior to calling this method.
Is there something we shouldn't be doing here? Has anyone else seen similar issues?
Update
It seems this works fine first time the link is opened after app-launch, but subsequent calls fail. Nothing seems to be called in a different order, so it's very confusing why we'd see this sort of pattern!