4
votes

I am working on a app which could be launched over a URL. I have already defined my url scheme using xcode on info page. I filled for identifier my Bundle identifier and for URL Schemes myapp.

Now if I try to open in safari myapp://foo, it launches my app and stops at my breakpoint in

- (BOOL)application:(UIApplication *)application
        openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
     annotation:(id)annotation

method.

Problem is annotation, url, application, sourceapplication parameters are nil. So I can not pass parameters...

enter image description here

2
Which version of iOS are you targeting/testing on? - bdesham
Are you saying that this method's url variable is nil, or that the parameterString of url (since it's an NSURL) is nil? How are you determining that it's nil? - Billy Lazzaro
Are you sure that you are passing a valid encoded link? I've often used this delegate method but I've never experienced that behavior! - Alexander
@BillyLazzaro nsurl is nil - Mert
@Alexander Like I told in my question, I am trying to open the address myapp://foo, and it launches my app, but I do not get the string foo. I have also tried myapp://?foo=1234, no luck... - Mert

2 Answers

0
votes

After unnecessary time loss, I have found out, the problem was the debugger. It shows the url is nil and if I try to print description it says

Printing description of url:
<nil>

But If I try to NSLog it shows the url. And if put the following code in the method

if (! url) {
    return NO;
}

The debugger shows also the url.

0
votes