gabaum10
gabaum10

Reputation: 3827

iPad custom URL help

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.

Upvotes: 0

Views: 303

Answers (1)

Erle
Erle

Reputation: 171

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

Upvotes: 1

Related Questions