0
votes

Created the URL Types in info.plist file and its URL scheme is http. Created the NSUserActivity Type. Created the entitlements, UIWebView in 'ViewController' class. In AppDelegate method I implemented below code:

func application (application: UIApplication,willContinueUserActivityWithType userActivityType: String) -> Bool  {
    let sharedUserActivityType = "com.test.testApp"
    if (userActivityType == sharedUserActivityType) {
        return true
    }
    return false
}

@available(iOS 8.0, *)

internal override func restoreUserActivityState(activity: NSUserActivity) {

    //don't forget to call super!

    if #available(iOS 8.0, *) {

        super.restoreUserActivityState(activity)

        let userInfo = activity.userInfo

    } else {
            // Fallback on earlier versions

    }
}

func application(application: UIApplication, continueUserActivity 
        userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> 
        Void) -> Bool {

    if  userActivity == "com.test.testApp.view"
    {
        let mainListing = ViewController()

        restorationHandler([mainListing])
    }

    if let window = self.window 
    {
        window.rootViewController?.restoreUserActivityState(userActivity)
    }

    return true
}

func application(app: UIApplication, openURL url: NSURL, options: 
        [String : AnyObject]) -> Bool {

    return true
}
1

1 Answers

0
votes

Your apple-app-site-association JSON file is in the incorrect format - appID key is missing within the details dictionary, i.e.

{ 
  "applinks": 
   { "apps":[], 
     "details": [
       {
         "appID": "teamId.com.test.testApp",  
         "paths":["*"] 
      } 
     ]
    } 
}

You can use the Apple verification tool to verify this in future.

Note as well even if you are on iOS9 you still need to serve the apple-app-site-association file via https.