Search code examples
iosserverdeep-linkinguniversal

Is there any way to add userInfo for iOS's universal links?


As I understand from documentation, i must parse URL in

-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler

But there is a Dictionary in userActivity property (userInfo), but this property is empty. It there any way to fill this property on server side and do not parse URL? Todays links are not analyzable.


Solution

  • Because Universal Links actually skip the browser completely (you click one and iOS sends you directly to the app without bouncing through Safari first) there is no way native way to add extra info from the server side. You're basically limited to only what you can include in (and later parse back out of) the URL string itself. You would need to set a data dictionary tied to the URL string in some outside system, and then check with that outside system inside the app to get that data back.

    Branch.io (full disclosure: I'm on the team) actually does exactly this. We encode a full dictionary of data for every Universal Link you create, and then you can retrieve it inside the app.