Search code examples
facebookapplinks

iOS facebook app links host api returning null


I run this code but it does not return any values. I am having a very difficult time getting my story posted to Facebook timeline to simply launch my app when clicked on. I am mostly mobile app so after trying the metatags and that not working either, i'm trying this hosted approach which is also not working. Anyone know what i am doing wrong?

[FBRequestConnection startWithGraphPath:@"/MyNumericFacebookAppID/app_link_hosts"
                             parameters:nil
                             HTTPMethod:@"GET"
                      completionHandler:^(
                                          FBRequestConnection *connection,
                                          id result,
                                          NSError *error
                                          ) {

                          _AppLinksHostURL_ID = [result objectForKey:@"id"]; // store this ID in an NSString

                          NSLog(@"App Links Result = %@", result);
                          NSLog(@"App Links Host URL ID = %@", _AppLinksHostURL_ID);

                          //[self postOGStoryWithCustomURL];
                          if(error) NSLog(@"error = %@", error.description);

                      }];

Solution

  • The app_link_hosts endpoint requires an app access token (with your app secret), so you shouldn't be doing this in your app (I will see about getting the docs updated accordingly).

    You should create them via the curl command, see https://developers.facebook.com/docs/applinks/hosting-api