So basically I'm developing an app (iOS 9) and set up the Associated Domains
that allows the app to be opened directly when the user taps a link for my app.
After tapping the link and my app is opened, a new back button appears on the status bar that allows the user to go back to the previous app, like this:
I'm catching this action (launching via link) by using:
- (BOOL)application:(nonnull UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray * __nullable))restorationHandler
{
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSURL *webURL = userActivity.webpageURL;
NSLog(@"%@", webURL.absoluteString);
}
return YES;
}
Is there a way to access this information (the previous app, Messages in this case) with NSUserActivity
or something similar?
There is nothing in the APIs that lets you do this the way you are thinking and it is not possible for Messages app. App links are one way. As of iOS 9, Apple has only provided a method to go back to the previous app, that is all.