16

Upon upgrading from the Facebook iOS SDK version 3.7.1 to 3.8, I started seeing the following in my console log when authenticating with my app through Facebook:

FBSDKLog: Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0xc5a9cf0 {com.facebook.sdk:HTTPStatusCode=400, com.facebook.sdk:ParsedJSONResponseKey={
    body =     {
        error =         {
            code = 100;
            message = "(#100) The parameter 'custom_events' or 'custom_events_file' is required for the 'CUSTOM_APP_EVENTS' activity";
            type = OAuthException;
        };
    };
    code = 400;
    headers =     (
                {
            name = "Access-Control-Allow-Origin";
            value = "*";
        },
                {
            name = "Cache-Control";
            value = "no-store";
        },
                {
            name = Connection;
            value = close;
        },
                {
            name = "Content-Type";
            value = "text/javascript; charset=UTF-8";
        },
                {
            name = Expires;
            value = "Sat, 01 Jan 2000 00:00:00 GMT";
        },
                {
            name = Pragma;
            value = "no-cache";
        },
                {
            name = "WWW-Authenticate";
            value = "OAuth \"Facebook Platform\" \"invalid_request\" \"(#100) The parameter 'custom_events' or 'custom_events_file' is required for the 'CUSTOM_APP_EVENTS' activity\"";
        },
                {
            name = "x-fb-loadmon";
            value = "0,2.76,90";
        }
    );
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x12e5e9c0, state: FBSessionStateOpen, loginHandler: 0x12e58630, appID:..., urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0xd884b00>, expirationDate:..., refreshDate:..., attemptedRefreshDate:..., permissions:...>}

I've downloaded the most recent versions of the sample Facebook iOS apps and verified that my calls to the Facebook SDK in my AppDelegate are up-to-date. To authenticate, I am sending the openActiveSessionWithReadPermissions:allowLoginUI:completionHandler: message to FBSession.

It seems like this very well could be a Facebook bug (I am going to file a bug with them), but it's also possible that I'm doing something wrong – any help/insights would be appreciated!

I've temporarily resolved the issue by adding a call to [FBAppEvents setFlushBehavior:FBAppEventsFlushBehaviorExplicitOnly]; in my AppDelegate, but I would prefer a more comprehensive solution.

3/24/2014 Edit

This no longer repros on 3.8 (nor does it repro on 3.13, which I also tested). Seems like Facebook must have fixed this on the server.

mon4goos
  • 1,539
  • 13
  • 22
  • I tried sample projects which come in Facebook SDK folder downloaded from Facebook. There is also same error for their official sample projects which are using official sample Facebook apps for interactions. I deleted my answer cause it's not the real solution as you think. – ersentekin Oct 03 '13 at 13:27
  • 3
    @ersentekin, interesting. Thanks for looking into that! I've filed a bug with them, so hopefully they'll resolve it soon. – mon4goos Oct 03 '13 at 21:23
  • 3
    @mon4goos Do you have the bug report link? – Nora Olsen Oct 11 '13 at 11:59

4 Answers4

9
  1. Go to developers.facebook.com
  2. From the header bar, click on "Apps"
  3. Select the app you're currently working on and click "Edit App"
  4. On the left hand navigation bar, you'll see a "Settings" tab
  5. Under "Settings" click on the "Advanced" tab and scroll down to the "Insights" section
  6. Change "Install Insights" and "Mobile SDK Insights" to "Disabled"
neverbendeasy
  • 938
  • 9
  • 17
  • 4
    Thanks for the comment. Although this will hide the problem, I don't think it solves the core issue. There should be way to keep those settings enabled, but not have the Facebook iOS SDK surface errors. – mon4goos Oct 11 '13 at 17:36
  • Yes, as @mon4goos says, its just a trick and not the real solution. Facebook should fix this important bug. Its really annoying if you are new to FB SDK – ersentekin Nov 15 '13 at 09:20
2

I am running FB SDK 3.9, and still getting this error.

I found this as a workaround.

Add this line in the AppDelegate::appDidFinishLaunchingWithOptions

[FBAppEvents setFlushBehavior:FBAppEventsFlushBehaviorExplicitOnly];
Rayfleck
  • 12,116
  • 7
  • 44
  • 72
0

Under Settings > Advanced in the Facebook app console try setting "Install Insights" and "Mobile SDK Insights" to disabled (unless you need it for marketing purposes)

ruxy
  • 282
  • 3
  • 9
  • How do you disable the insights from Advanced settings? Do you do that in xcode? – dreamer_999 Oct 05 '13 at 00:31
  • As I mentioned in my comment to @neverbendeasy, although this will hide the problem, I don't think it solves the core issue. There should be way to keep those settings enabled, but not have the Facebook iOS SDK surface errors. – mon4goos Oct 11 '13 at 17:38
0

I got the same error, Upgrading to FacebookSDK 3.9 fixed it for me. I did not have to disable insights.

gabriellanata
  • 2,797
  • 2
  • 18
  • 26