Deep Linking in iOS


Deep Linking :-


A Deeplink  much like a traditional hyperlink on a webpage. It is composed of separate elements that make up what is referred to as a Uniform Resource Identifier (URI)/URL Schemes. The URL Schemes contains all the information that, when invoked, launches a mobile application with a specific screen.
The URL Schemes Contain "ecommercebrand://" these type of word to redirect from safari to application.


Handling the opening of registered urls within your app

Now that you have ensured that deep linking is working, we need to handle the url used to launch the app. In it’s current state, your app can be launched using a simple url, but it can’t do much beyond that. To do more, we need to override the following function in AppDelegate:


1
2
3
4
-(BOOL)application:(UIApplication *)application
          openURL:(NSURL *)url
          sourceApplication:(NSString *)sourceApplication
          annotation:(id)annotation

Note that this is not present by default, and needs to be added. This function gets called every time your app is launched using the registered url-scheme. The passed in arguments are:
  • url: The complete url used to launch the app.
  • sourceApplication: The bundle ID for the application from which the url was called.
  • annotation: A property list object that can be used to pass additional info along with the url.
The format of the url is as follows: [scheme]://[host]/[path]

Breaking this down, we get:
  • scheme: The url scheme tells iOS what app to launch. Note that the url scheme should be registered with the device for it to be able to handle this (this is what we did in the previous section).
  • host: The host is analogous to a website/server name on the web. You can handle multiple hosts within your app.
  • path: The path enables you to provide additional information regarding the location within your app.
In general, you would use the host and path parameters to determine what the user intends to do.
The Right contents of this method largely depend on your needs, but for the purpose of this post, we will check the host and then based on the path, load a particular ViewController.


-(BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation{ if([[url host] isEqualToString:@"page"]){ if([[url path] isEqualToString:@"/page1"]){ [self.mainController pushViewController:
[[Page1ViewController alloc] init]
animated:YES]; } return YES; }


If you want use  Deep Linking in your application free for iOS as well as for android use below website as given below

https://hokolinks.com/









Comments

Popular posts from this blog

Google drive 60 new templates

Gorgeous iPhone 6 concept shows how amazing iOS 7 would look on a big, bezel-free display

Natural sense of touch restored with bionic hand