0

I am using Facebook's AppLinks deferred deep linking (DDL) option to pass some custom deep link info upon install. Once I get the DDL trigger, I call a certain external URL to log the DDL activity using a simple call to stringWithContentsOfURL. For some unexplained reason, the URL is automatically injected with a 'al_applink_data' param although I did not add it (I only add 'deeplink' and 'idfa' manually). How does it get 'injected' into my URL call? Here is the DDL trigger code:

- (void) onFbDeferredAppLink:(NSURL*)deeplink error:(NSError*)error {
    NSLog(@"onFbDeferredAppLink: %@", deeplink);
    NSMutableDictionary* d = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                          deeplink, @"deeplink",
                          [self getIdfa], @"idfa"
                          , nil];
    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
               ^{
                   NSError* error = nil;
                   __block NSMutableString* s = [NSMutableString stringWithString:@"https://api.myservers.com/test.php?a=b"];
                   [d enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
                       [s appendFormat:@"&%@=%@", [key description], [obj description]];
                   }];
                   NSURL* url = [NSURL URLWithString:s];
                   [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error];
               });
Sagi Mann
  • 2,967
  • 6
  • 39
  • 72

1 Answers1

0

The 'al_applink_data' param is part of the App Links protocol, so it's already embedded in your deeplink URL. The deeplink URL basically looks like:

<custom_scheme>://<path>?al_applink_data=<some json blob>
Ming Li
  • 15,672
  • 3
  • 37
  • 35
  • The first NSLog output shows the deeplink as "myapp://localhost/?aaa=bbb" - exactly what I defined in my facebook campaign. It does not contain any "al_applink_data" parameter. If you are correct, then maybe the NSLog command does not really print out the entire link? Unlikely, as it does print other params I put on the deeplink myself (aaa=bbb). Am I missing anything? – Sagi Mann Aug 17 '15 at 07:01
  • The al_applink_data may not be the first parameter in the query string. Is this actually causing issues in your code? If you use the standard url parsing libraries that obj-c provides, there shouldn't be an issue. I would avoid doing strict string matching since that doesn't work well for urls. – Ming Li Aug 18 '15 at 18:45
  • As you can see from the NSLog, the al_applink_data is nowhere on the deep link input parameter (unless, again, NSLog does not print the entire URL for some reason, but I can't imagine why). – Sagi Mann Aug 20 '15 at 13:43