iOS Custom Url Scheme XCode -


first of all, know how make custom schemes in ios , know how open app website using javascript settimeout method.

i have app uses custom url scheme , working great. is, sends http://testsite.com/querystrings message other users in contact list (predefined) , on clicking web links in sms, these things happen:

  1. open link in safari
  2. open app if installed custom url using settimeout
  3. if not installed, move normal website page

what wanted open app directly sms if installed have send custom url scheme in sms, not option because if app not installed sms wont work weblink option now.

today, installed soundcloud , accidentally noticed thing when http:// m. soundcloud .com /... url sent in sms , on clicking link opens app (if installed) directly not safari (strange me).

so wondering how come app open web link without opening safari. googled around couldn't find solution problem. attaching screenshot mobile press , hold on link in messages app give open in "soundcloud" option well. how soundcloud registered http link handled automatically in app. please guys

screenshot of soundcloud open

the answer problem using associated domains (but after 9.2 have use universal links achieve this).

before universal links, primary mechanism open app when installed trying redirect app’s uri scheme (registered in app’s plist so) in safari. put routing logic in safari, there no way check if app installed or not.

ios 9 universal links intended fix this. instead of opening safari first when link clicked, ios check if universal link has been registered domain associated link, check if corresponding app installed. if app installed, opened. if it’s not, safari open , http(s) link load.

functionally, allows have single link either open app or open mobile site.

configure app register approved domains

  1. registered app @ developers.apple.com
  2. enable ‘associated domains’ on app identifier
  3. enable ‘associated domain’ on in xcode project
  4. add proper domain entitlement
  5. make sure entitlements file included @ build

configure website host ‘apple-app-site-association’ file

  1. buy domain name or pick existing
  2. acquire ssl certification domain name
  3. create structured ‘apple-app-site-association’ json file
  4. sign json file ssl certification
  5. configure file server

apple launched universal links in ios 9.0, moves app routing os developers don’t need worry doing routing in javascript.

receiving universal link url in app

uri schemes received deep link url through openurl in app delegate. universal links receive data via different code path: continueuseractivity. new delegate method used number of app transitions, ranging spotlight universal links, , see couple more use cases introduced in future os versions.

below snippet of code can use retrieve full universal link url opened app.

- (bool)application:(uiapplication *)application continueuseractivity:(nsuseractivity *)useractivity restorationhandler:(void (^)(nsarray *))restorationhandler {     if ([useractivity.activitytype isequaltostring:nsuseractivitytypebrowsingweb]) {         nsstring *myurl = [useractivity.webpageurl absolutestring];         // parse url string or access query params     }     return yes; } 

source: https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -