I'm developing a React Native app for iOS.
This app has to be able to open deeplinks and it works fine when the app is opened in background.When the app is close, the native iOS code (Objective-C) does not get the URL the app has been opened with.
As I understand how it works, I have to check the NSDictionary of the launchOptions to see if the app has been started through an URL. If the key corresponding to URL initialization exists then I return true to execute the following code
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options { return [RCTLinkingManager application:application openURL:url options:options]; return YES;}
This is the function that has to bee executed to get the Initial Url which the app has been opened with. Here is my code of app didFinishWithLaunchOptions:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ if ([launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]) { return true; }}