Deep linking becomes so important for iOS 9 as it will be connecting with brand new search mechanism in iOS 9.
This video introduces universal links to the apps when they tap links on the websites.
Demo (WWDC app) tapping website links -> native app detail page
Breakdown of a universal link
iOS looks for
URLQueryItem
to assess url easily
Getting server ready
apple-app-site-association
json file{
"applinks": {
"apps": [],
"details": {
"9JA89QQLNQ.com.apple.wwdc": {
"paths":[ "/wwdc/news/,
"/videos/wwdc/2015/*"]
}
}
}
}
openssl smime \
-sign \
-nodetach \
- in "unsigned.json"
- out "apple-app-site-association"
upload the signed json file to https://www.example.com/apple-app-site-association
available in iOS 8
iOS 9 seed no need to sign the json
Getting your app ready
func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler:([AnyObject]!) -> void) -> Bool
var webpageURL:NSURL ?
check activityType == NSUserActivityTypeBrowsingWeb
breakdown the url and treat it like deep link
use NSURLComponent
Update entitlement with associated domain add domain as : applinks:www.example.com
Best practice
still need HTTP? Related session : Networking with NSURLSession
Demo to adopt universal links
Advantages of using universal links
available iOS 8
{
"applinks": {
"apps": [],
"details": {
"9JA89QQLNQ.com.apple.wwdc": {
"paths":[ "/wwdc/news/,
"/videos/wwdc/2015/*"]
}
}
}
"webcredentials" : {
"apps" : [ "a1234567".com.example.AppName"]
}
}
SecRequestSharedWebCredential(nil, nil) { cfcredentials, error in
//to check if there are any existing credentials for login
// if it does , access the user name and password from cfcredentials and login (call ui in main queue)
// if it does not, show login ui(call ui in main queue)
};
SecAddSharedWebCredentials("example.com", userName, password) {
error in ...
}
let password:String = SecCreateSharedWebCredentialPassword().takeRetainedValue() as String
//print it or something else.
Related session : Your app, Your website and safari