Introduction to IOS Deeplinkkit usage

Source: Internet
Author: User

Needless to say, the need to do this first:


1. Some social elements in the app share a link to social media such as Facebook, Twitter, and Google +
2. When users click on a link to jump to their own page, and then pass the parameters to the iOS app to open the specified sharing data

Idea: iOS provides scheme This can be used to jump to your app from a browser or other app to query scheme-related content.
Find Deeplinkkit This third-party component on GitHub after probably understanding the scheme mechanism.

Use the following:

1. Add a URL Type in plist, such as URL schemes called Com.test.test

2. Add the following code to the Appdelegate:

-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions{    Router = [[Dpldeeplinkrouter alloc] init];        Browser call URL: "com.test.test://l/aa/123/456", so BB takes to 123, CC takes to 456    router[@ "/aa/:bb/:cc"] = ^ (Dpldeeplink *link) {        NSLog (@ "----------Deeplink:%@,%@----------", link.routeparameters[@ "BB"], link.routeparameters[@ "CC"]);    }; }

3. Add the following code to the Appdelegate:
-(BOOL) Application: (UIApplication *) application            OpenURL: (nsurl *) URL  sourceapplication: (NSString *) Sourceapplication         annotation: (id) annotation {    BOOL success = [Router Handleurl:url withcompletion:nil];    return success;}

4. Return the app to the background and enter com.test.test://l/aa/123/456 in the browser, where the router block will take effect.
Explain, here L is deeplinkkit this component needs, but the content can be entered casually, in short, must have a field before host. AA is the host mentioned in Deeplinkkit, which is the same as the character registered with router. The rest doesn't have to be explained.

Use down, deeplinkkit or relatively simple, but the document is not well written, I read a long code, which research his demo help the most.

Hope that the students who need to do deep links to help, have any questions, please leave a message here, we communicate together. Thank you!


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Original address: http://blog.csdn.net/piratest/article/details/46820321

Introduction to IOS Deeplinkkit use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.