Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check which Application the user came from after tapping a link (Associated Domains) of my App?

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:
enter image description here

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?

like image 798
Pedro Vieira Avatar asked Jun 25 '15 15:06

Pedro Vieira


1 Answers

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.

like image 127
Zia Avatar answered Nov 09 '22 08:11

Zia