I have implemented universal links into my app but for reason, AASA file is not going to be uploaded on server for now.
Yes you actually can!
You can test you app's response to a deep link without actually implementing the remote side by calling this function from terminal:
$ xcrun simctl openurl booted 'YOUR_LINK_HERE'
This will trigger the following callback in your app's appDelegate:
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool
...which is exactly the behavior you should expect from a deep link.
just don't forget to actually have the simulator up ;-)
As for universal links - the appDelegate callback is slightly different, but its a very small mental leap:
func application(_ app: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
if userActivity.activityType == NSUserActivityTypeBrowsingWeb {
if let url = userActivity.webpageURL {
// parse the url and decide how to handle the universal link
}
}
return true
}
No, you must upload "apple-app-site-association" on the server with your bundle id and team id. You cant test without it. Also you cant test it using someone else's "apple-app-site-association" file as it's team id and bundle id will be different.
You can upload your AASA file on heroku server for testing purposes.
Apple does not appear to support this.
However, you can simply call the delegate method directly from anywhere in your program.
NSUserActivity *activity = [[NSUserActivity alloc] initWithActivityType:NSUserActivityTypeBrowsingWeb];
activity.webpageURL = [NSURL URLWithString:@"https://<your-domain.com>/route"];
[UIApplication.sharedApplication.delegate application: UIApplication.sharedApplication continueUserActivity:activity restorationHandler:^(id restorableObjects) {
}];
© 2022 - 2024 — McMap. All rights reserved.