Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Error (7) iOS 6 [duplicate]

Though, there is such a question Facebook Error (7) iOS 6 it's already closed without any answer! While obtaining an access to user's facebook account I've got an error: error is: Error Domain=com.apple.accounts Code=7 "The Facebook server could not fulfill this access request: The proxied app is not already installed." UserInfo=0xa260270 {NSLocalizedDescription=The Facebook server could not fulfill this access request: The proxied app is not already installed.}

I'm performing a request like this:

self.statusLabel.text = @"Waiting for authorization...";
if (self.accountStore == nil) {
    self.accountStore = [[ACAccountStore alloc] init];
}   
ACAccountType * facebookAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

NSDictionary * dict = @{ACFacebookAppIdKey : FB_APP_ID, ACFacebookAudienceKey : ACFacebookAudienceEveryone};
[self.accountStore requestAccessToAccountsWithType:facebookAccountType options:dict completion:^(BOOL granted, NSError *error) {
    __block NSString * statusText = nil;
    if (granted) {
        statusText = @"Logged in";
        NSArray * accounts = [self.accountStore accountsWithAccountType:facebookAccountType];
        self.facebookAccount = [accounts lastObject];
        NSLog(@"account is: %@", self.facebookAccount);
        self.statusLabel.text = statusText;
        [self postToFeed];
    }
    else {
        self.statusLabel.text = @"Login failed";
        NSLog(@"error is: %@", error);
    }
}];

What does this error means?

like image 472
Stas Avatar asked Oct 02 '12 07:10

Stas


3 Answers

I've solved this problem! It was because I do not pass permissions array! Though the ACAccountStore class states that this parameter is optional, it is not! enter image description here

More over the application could launch and ask for basic permissions(as it is implied)!

enter image description here

So, you must always pass a permissions array.

Here's also a description of error codes returned by account store:

typedef enum ACErrorCode {
   ACErrorUnknown = 1,
   ACErrorAccountMissingRequiredProperty,
   ACErrorAccountAuthenticationFailed,
   ACErrorAccountTypeInvalid,
   ACErrorAccountAlreadyExists,
   ACErrorAccountNotFound,
   ACErrorPermissionDenied,
   ACErrorAccessInfoInvalid
} ACErrorCode;

(I've got ACErrorPermissionDenied here)

like image 193
Stas Avatar answered Nov 15 '22 20:11

Stas


We had the same problem and after taking a closer look at the iOS facebook documentation ad

https://developers.facebook.com/docs/howtos/ios-6/

I noticed the following paragraph:

Note, to use iOS 6 native auth, apps need change the way they request permissions from users - apps must separate their requests for read and write permissions.

I must have read over that one several time but it contained the solution:

You have to do multiple request for access if you want to grant write (publish access). So now we first ask for permission 'email' to get read permission and then for 'publish_action' to be able to post to the timeline.

like image 22
Thomas Einwaller Avatar answered Nov 15 '22 20:11

Thomas Einwaller


The error message is not clear since "app" could be your iOS app? Facebook.app on the phone? Facebook app? The "proxied app" is the Facebook app, and "not already installed" means, it's not yet been associated with the Facebook user online in terms of permissions.

The first time your Facebook app connects to the users Facebook account, you must specify the basic info value(s) in your ACFacebookPermissionsKey key of the options dictionary. Other Facebook SDK's past and present such as the Javascript or PHP libraries by default supply basic info as the key, so you never had to. It seems the native integration in iOS doesn't do this, thus, if when the user first connects your app to their Facebook account with no permissions supplied, you get this error.

After you are given access, i.e. - after the user is connected to the app in their privacy settings online, ACFacebookPermissionsKey does as Apple document, become optional.

It's all a little confusing when you start to try and use the native Facebook integration...

Using the native Facebook integration you must provide one of the following keys which are basic info keys: email, user_birthday, or user_location.

To quote Facebook (source):

To create this basic connection using the iOS 6 native Auth Dialog, apps must request access to a user's basic profile information by asking for one of email, user_birthday, or user_location permissions.

like image 24
Daniel Avatar answered Nov 15 '22 20:11

Daniel