Question

I was wondering if any one knows how to create you own hooks in your app.

for example i got an sms with a custom url like myapp://location?id=1

and when you click on it it opens myapp and shows me what location?id=1 is

Was it helpful?

Solution

The "hook" is within your AppDelegate.

Implement the following method...

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    NSString* tUrlString = url.absoluteString;
    // ... analyse tUrlString
    // ... do something
    return YES;
}

Furthermore you have to register your app for reacting to the "myapp://" URL scheme (if not already done). This can be done in the "URL Types" within the "Info" section of your app's target.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top