Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error the operation could'nt be completed. (com.facebook.sdk error 2.) #596

Closed
lakshmen opened this issue Nov 26, 2012 · 15 comments
Closed

Comments

@lakshmen
Copy link

My app is working fine in both simulator and the device with ios6. But when i use the app in the ios5, i am able to login into facebook and go to the facebook app. However, when the app is about to post, it is not able to do but pops up " error the operation could'nt be completed. (com.facebook.sdk error 2.)". I have already checked the bundle id and the settings. Not sure how to solve the error. I am using sharekit to integrate the sharing. Need some help on that.

@cihancimen
Copy link

I was able to solve this issue by wrapping code in SHKFacebook.m

- (void)share

method in dispatch_async so the resulting code is like

- (void)share {
    dispatch_async(dispatch_get_current_queue(), ^{
        if ([self socialFrameworkAvailable]) {

            SHKSharer *iosSharer = [SHKiOSFacebook shareItem:self.item];
            iosSharer.quiet = self.quiet;
            iosSharer.delegate = self.delegate;
            [SHKFacebook logout];

        } else {

            [super share];
        }
    });
}

Please see this question for further discussion.

@lakshmen
Copy link
Author

Hi, thanks for replying. I have changed that and it has no effect. I have no problem logging in, but have problem authenticating the post to my wall...

@zoltan-tornoczky
Copy link

Hi! I have a similar problem, but I'm not sure it is the same. I got 'error 2' too, but the message posts to facebook (Saved message also appears). This only happens when Safari pops up to authorize the applicaiton.

I did not find the solution, but I found something which could help (tried to dig the ShareKit source, but I couldn't fully understand the control flow):
https://github.com/davejohnson/phonegap-plugin-facebook-connect/blob/master/README.md#ios-mac-os-x
This doc says under iOS (Mac OS X)/NOTE2: thet this happens when read and write privileges are requested together. There is a linked facebook doc which describes how the permission requests changed in FB SDK 3.1.

@lakshmen
Copy link
Author

Hi zoltan,

thanks for replying and sorry for the late reply. doesn't sharekit take care of that.

//Change if your app needs some special Facebook permissions only. In most cases you can leave it as it is.

// new with the 3.1 SDK facebook wants you to request read and publish permissions separatly. If you don't
// you won't get a smooth login/auth flow. Since ShareKit does not require any read permissions.

  • (NSArray*)facebookWritePermissions {
    return [NSArray arrayWithObjects:@"publish_actions",@"publish_stream", nil];
    //@"offline_access",
    }
  • (NSArray*)facebookReadPermissions {
    return nil; // this is the defaul value for the SDK and will afford basic read permissions
    }

@zoltan-tornoczky
Copy link

Couldn't find the cause of this problem, but I updated to the latest ShareKit today, and the problem doesn't come up now!

@lakshmen
Copy link
Author

to update, what do you need to do?

Is this what you need to do:

cd Submodules/ShareKit
git submodule update --init --recursive

I am not sure..

@zoltan-tornoczky
Copy link

The doc says the command you wrote, but that did nothing for me... Try to do a git pull in the ShareKit directory.

@VilemKurz
Copy link
Contributor

@lakshmen those commands are for downloading/updating ShareKit submodules only. On the other side @zoltan-tornoczky git pull in ShareKit dir only updates ShareKit files - keep in mind that also ShareKit's submodules might have changed.

Proper steps to update ShareKit are in FAQ

@zoltan-tornoczky interesting is that update helped, but Facebook sharer was not touched... maybe you deleted the app from device/sim in the meantime?

@zoltan-tornoczky
Copy link

I had revision 8493062. The facebook sharer was modified in 4 commits since that.

My first comment was before those commits.

@vishnuvardhanpv
Copy link

I just pulled out the latest ShareKit to share multiple images. But whenever a user logins for the first time, or logs out and login again, the facebook dialog saying "You have already authorized . Press "Okay" to continue" appears. But when clicking Okay, the same dialog appears again. Pressing "Okay" again, app shows an error "The operation couldn't be completed.(com.facebook.sdk error 2.)". But the image is getting shared. Am not getting what the reason is. Could anyone please help me?

@carlos-soto
Copy link

I had a similar problem, when trying to log in the system prompted me to allow access. I accidentally clicked "Deny". Now, if I try to log in again, it throws that error. I deleted the app from the ipad, cleaned, rebuild, etc., with no success... This is stupid, it should prompt me for the previous dialog again so I can allow the app access... Somebody help? :(

@livyathan
Copy link

I already solved this problem and (probably) it's not related to ShareKit.

Check out your app configuration on:

https://developers.facebook.com/apps..

Be sure the "Sandbox" value is set to "Disabled". If it's enabled, you will have to set a value on the "Privacy policy URL" (it's not on the same form) to disabled it. When the sandbox mode is enabled, the app wont work unless you are marked as a developer.

After disabling the Sandbox mode, just wait an hour or so and it should be working fine again.

If this isn't working for you, check this post:

http://stackoverflow.com/questions/11591637/facebook-ios-sdk-3-0-active-session-fbiossdk-error2

I recommend to read all answer first, before doing anything.

Hope that helps.

Best regards

@VilemKurz
Copy link
Contributor

That is a great news! Can someone else confirm it helped, so that I can close the issue?

@lakshmen
Copy link
Author

i have ensured that the sandbox mode is disabled. but the error still pops up. Not sure why?

@VilemKurz
Copy link
Contributor

have you resolved the issue? FB ios sdk is updated to latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants