Get Facebook API for App Links

I am trying to get app_link_hosts using the facebook graph version method for iOS, but I get an error. Can someone help me fix this issue. The documentation on Facebook and the app is not clear.

Here is the code

NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: @"app name", @"name", theUrl, @"al:ios:url", @"app store id", @"al:ios_id", @"app name", @"al:ios:app_name", @"{\"should_fallback\": false}", @"web", fbAccessToken, @"access_token", nil ]; /* make the API call */ [FBRequestConnection startWithGraphPath:@"/(fb app id)/app_link_hosts" parameters:params HTTPMethod:@"POST" completionHandler:^( FBRequestConnection *connection, id result, NSError *error ) { /* handle the result */ NSLog(@"Result = %@",result); if(error) NSLog(@"error = %@",error); }]; 

This is the error I received

  error = Error Domain=com.facebook.sdk Code=5 "The operation couldn't be completed. (com.facebook.sdk error 5.)" UserInfo=0x8c7d4b0 {com.facebook.sdk:HTTPStatusCode=403, com.facebook.sdk:ParsedJSONResponseKey={ body = { error = { code = 200; message = "(#200) Permissions error"; type = OAuthException; }; }; code = 403; }, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x9a53750, state: FBSessionStateOpen, loginHandler: 0x9a51fd0, appID: 443803585653119, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x9a52960>, expirationDate: 2014-09-12 10:12:17 +0000, refreshDate: 2014-07-14 12:00:51 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:( installed, "public_profile", "publish_actions", "user_friends" )>} 
+6
source share
1 answer

I assume that you are using the "user access token" instead of the "application token" that is required to create links to applications. try creating a test link using Graph api explorer - https://developers.facebook.com/tools/explorer/ (selecting the application token parameter), since this is not a good practice for generating from client devices.

0
source

Source: https://habr.com/ru/post/972231/


All Articles