I am Working on a app in which there is a Registration field. When Registration is done successfully I get a confirmation mail. When I Confirm the link then I want to navigate back to my app using URL Schemes. How Can I achieve this.
Thanks.
Register your scheme in Xcode from the Info tab of your project settings. Update the URL Types section to declare all of the URL schemes your app supports, as shown in the following illustration. In the URL Schemes box, specify the prefix you use for your URLs.
For this, just Open Xcode, go to Project Settings -> Info, and add inside 'The URL Types” section a new URL scheme. Add something of the sort of com. globalApp and that's it. Now install your app, open the browser type com.
Using the URL scheme, you've now registered the URL with the app. You can start the application by opening a URL with the custom scheme.
Use UIApplicationDelegate
if you want to provide a custom handler for it. All you need to do is provide an implementation for it in your delegate.
Then get it:
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
if (!url) {
return NO;
}
// Do something with the url here
}
Refer to this.
In the project target, go to the Info tab and add a URL types
in the URL Schemes field - let's say "myApp".
Then, the email should contain a link like: myApp://something
and your app will be launched.
Best practice would require that you actually check that "something" and show the user a "confirmation" message.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With