application:openURL:sourceApplication:annotation: returns a null url
I need my iOS app to handle app-URLs like myapp://d1/d2.
I set the URL Typesin my app's info.plist and implemented the required
delegate method:
-(BOOL) application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
...
}
I run my app, then switch to Safari (thus my app runs in the background).
In Safari I open URL myapp://d1/d2. As a result my app pops to the
foreground as advertised and the method above is called. The problem is
that that all its parameters (application, url, sourceApplication and
annotation) are null.
After spending some time and not getting any non-null parameters, I tried
to replace the method above with the depreciated
application:handleOpenURL:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
...
}
That worked. The `url' parameter is exactly what I typed in Safari.
Obviously I don't want to use a depreciated method. What am I doing wrong?
Running on iPad with iOS 6.1.3, and on a simulator.
No comments:
Post a Comment