React Native always read UIApplicationLaunchOptionsURLKey with null

27 Views Asked by At

in react-native 0.68.3 using universal link iOS -> can't read UIApplicationLaunchOptionsURLKey always null

in iOS, iPhone 13, 17.1.2

i'm using real device when debugging.

  • open notes app.
  • add url to notes as deeplink like www.myapp.com/profile
  • app is opened & navigated to profile screen successfully.

but in iOS code inside didFinishLaunchingWithOptions

i can't read UIApplicationLaunchOptionsURLKey or UIApplicationLaunchOptionsSourceApplicationKey values always null

this is my AppDelegate.mm related block

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    NSString *sourceApplication = launchOptions[UIApplicationLaunchOptionsSourceApplicationKey];
    NSString *sourceURL = launchOptions[UIApplicationLaunchOptionsURLKey];
     if (sourceApplication) {
         NSLog(@"SHERIF_TEST UIApplicationLaunchOptionsSourceApplicationKey: %@", sourceApplication);
     } else {
         NSLog(@"SHERIF_TEST No UIApplicationLaunchOptionsSourceApplicationKey found in launchOptions");
     }
  
    if (sourceURL) {
        NSLog(@"SHERIF_TEST UIApplicationLaunchOptionsURLKey: %@", sourceURL);
    } else {
        NSLog(@"SHERIF_TEST No UIApplicationLaunchOptionsURLKey found in launchOptions");
    }

and this is AppDelegate.h

#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>

@property (nonatomic, strong) UIWindow *window;

@end

i'm expecting for this data to be parsed successfully, because we are using SDK depend to read this data in background for tracking events Segment https://segment.com/

0

There are 0 best solutions below