最近我在我的应用程序中通过facebook集成了授权。
我的授权代码:
AppDelegate *mainDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
if (!mainDelegate.session || mainDelegate.session.state != FBSessionStateCreated)
{
mainDelegate.session = [[FBSession alloc] initWithPermissions:[NSArray arrayWithObjects:@"email", @"offline_access", @"user_birthday", @"user_photos", @"publish_actions", @"publish_stream", @"read_stream", nil]];
}
[mainDelegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error)
{
FBSession.activeSession = session;
if(mainDelegate.session.isOpen)
{
//getting access token
}
}];
但之后我收到了:
FBSDKLog: Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x17e5aa80 {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,49.16,50";
}
);
}, com.facebook.sdk:ErrorSessionKey=<FBSession: 0x17eac610, state: FBSessionStateOpen, loginHandler: 0x17eeb1d0, appID: 123456789012345, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x17ecef60>, expirationDate: 2014-01-07 10:09:59 +0000, refreshDate: 2013-11-08 10:28:09 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
email,
"offline_access",
"user_birthday",
"user_photos",
"publish_actions",
"publish_stream",
"read_stream"
)>}
我已停用此处提供的“安装数据洞察”和“移动SDK洞察”:The parameter 'custom_events' or 'custom_events_file' is required for the 'CUSTOM_APP_EVENTS' activity但我仍然看到此错误 我在一周前禁用了洞察,因此服务器已经更新了设置。
但是尽管有这个错误,授权工作正常,我正在成功获取访问令牌和所有需要的数据。 但是我担心这个,如果这个错误可以在将来提供问题。 我怎么能避免这个?为什么会出现此错误?