问题
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.
回答1:
- Go to developers.facebook.com
- From the header bar, click on "Apps"
- Select the app you're currently working on and click "Edit App"
- On the left hand navigation bar, you'll see a "Settings" tab
- Under "Settings" click on the "Advanced" tab and scroll down to the "Insights" section
- Change "Install Insights" and "Mobile SDK Insights" to "Disabled"
回答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];
回答3:
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)
回答4:
I got the same error, Upgrading to FacebookSDK 3.9 fixed it for me. I did not have to disable insights.
来源:https://stackoverflow.com/questions/19126703/the-parameter-custom-events-or-custom-events-file-is-required-for-the-custo