Launch iOS Application From Safari Using CustomURLScheme
If
you want to take user back from Safari to your iOS Application, you
can achieve it using custom url scheme.
Follow
the steps:
1.
Open -info.plist file and add
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>myapplicationurl</string>
</array>
</dict>
</array>
2.
Above code will register a custom url for your application.
3.
You can also pass parameters (query string) to it:
myapplicationurl://
myapplicationurl://?key1=value1&key2=value2
4.
When this url is called from Safari iPhone SDK sends message to
UIApplicationDelegate
-
(BOOL)application:(UIApplication
*)application handleOpenURL:(NSURL
*)url
{
//
You are back to your application.
NSLog(@"Yeah!!!
We are back to Application from Safari");
return
YES;
}
5.
Above method in UIApplicationDelegate
will be called and we are navigated to our Native iOS app from
Safari.
This
same technique is used by Facebook iOS sdk.
Special
thanks to
:
http://mobiledevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
First download source code from here: Download
After downloading run application and hit 'Open Safari' button it will take you to safari and will show you this page, now on this page hit below link 'Open Application from SAFARI' you are navigated back to application.
thanks you very much! Excellent blog!
ReplyDeleteHello
ReplyDeleteThanks for sharing great web blog . . . .
If any Facebook and Iphone user wants to custom apps .
they can check our link . . .
we are expert to making custom apps thanks for read my comment.
Custom Facebook and IPhone Apps