最近我在我的应用程序中通过 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 见解”:“CUSTOM_APP_EVENTS”活动需要参数“custom_events”或“custom_events_file”,但我仍然看到此错误我在一周前禁用了见解,因此服务器已经更新的设置。
但是尽管有这个错误,授权工作正常,我成功地获得了访问令牌和所有需要的数据。但是我担心这个,如果这个错误将来会带来问题。我怎样才能避免这种情况?为什么会出现这个错误?