views:

58

answers:

1

Hello,

So I am trying to probe the UIApplicationLaunchOptionsURLKey to see if my application was launched by another app. For example, what if I want to do something like this:

if (UIApplicationLaunchOptionsURLKey != NULL) {
    [window addSubview:launchViewController.view];
} else {
    [window addSubview:viewController.view];
}

In other words, if the app is launched from the desktop, it will show one view, but if it called from another app through a custom URL, it will display a different view. When I step through and examine the field, it says "Unknown type". Any ideas? Thanks ahead of time.

+1  A: 

I think you use it in

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 

I suggest using

 NSURL *launchURL=(NSURL *)[launchOptions valueForKey:@"UIApplicationLaunchOptionsURLKey"];
 if (launchURL != nil) {
    [window addSubview:launchViewController.view];
} else {
    [window addSubview:viewController.view];
}

I'm not sure but that could do the trick

Erle
Absolutely beautiful. There are so many little quirky methods to remember to extract data like that. Thanks a lot!
gabaum10