IOS and GET generic link options

we are trying to implement indexing of applications on iOS using universal Apple links (I look at https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308 -CH12-SW2 ).

In the "Creating and loading an association file" section, I see that I can limit indexing to specific pages, which is good.

I would like to limit the indexing https://www.mywebsite.com?parameter=something , how can I?

I was thinking about something like this:

{ "applinks": { "apps": [], "details": [ { "appID": "MYID", "paths":[ "*?parameter=*" ] } ] } } 

Do you think this might work? I still can’t test it, because it takes time to get authorization to upload files to the root directory of the site, so I ask you if you think this might work, I would like to upload a file only once, if I can.

thanks

+6
source share
2 answers

NO , Currently # (inline-links) and? (query-parmeter) is not supported by Universal Links . Apple did not provide a format for supporting Inline-Links and Query-Parmeter in the apple-app-site-association file.

To do the indexing https://www.mywebsite.com?parameter=something , I use the following json file.

 { "applinks": { "apps": [], "details": [ { "appID": "TEAMID.BUNDLEID", "paths":[ "*" ] } ] } } 

If you want to restrict indexing to only a certain parameter, for example query_parmeter1 and query_parmeter2 , then you need to handle this in the UIApplicationDelegate [UIApplicationDelegate application: continueUserActivity: restorationHandler:] method something like this

 -(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{ if ([userActivity.activityType isEqualToString: NSUserActivityTypeBrowsingWeb]) { NSURL *url = userActivity.webpageURL; if ([url.query containsString:@"query_parmeter1"]) { //handle code for query_parmeter1 }else if ([url.query containsString:@"query_parmeter2"]){ //handle code for query_parmeter2 } } return YES; } 

Note. This trick will not prevent the application from opening when you click a link to a website.

Links - Processing request parameters in universal links

+10
source

For request parameters added to the path to the base domain (i.e. https://www.mywebsite.com/pathOffOfTheBaseDomain?parameter=something ):

 { "applinks": { "apps": [], "details": [ { "appID": "TEAMID.BUNDLEID", "paths":[ "/pathOffOfTheBaseDomain" ] } ] } } 

According to Apple Universal Link Documentation :

Note that only the path component of the URL is used for comparison. Other components, such as the query string or fragment identifier, are ignored.

The full URL will be ready and ready to be parsed in the AppDelegate continueUserActivity method.

+2
source

All Articles