![](/img/trans.png)
[英]Facebook Warning for entering the credentials is not coming on real device IOS6
[英]In facebook ios6 not entering in to the if(granted ) loop "Sign in with Facebook"
嗨,我正在“使用 facebook 登录”工作,我的代码在下面这里没有进入 if(granted) 循环。 在我单击弹出窗口中的“确定”后,控制台打印如下 2 012-11-28 15:47:08.558 Tattoo Later[2748:1d34b] type:com.apple.facebook identifier: B962F897-6BAE-4769-8C04-B1B3D2C872A2 accountDescription: Facebook username: example@yahoo.co.in objectID: x-coredata://EBF41CAD-7388-45E0-8621-3958C7A67491/Account/p1 enabledDataclasses: {( "com.apple.Dataclass.Contacts", "com.apple.Dataclass.Calendars" )} enableAndSyncableDataclasses: {( )} properties: { fullname = "Example"; uid = 100001462475956; } parentAccount: (null) owningBundleID:(null)
012-11-28 15:47:08.558 Tattoo Later[2748:1d34b] type:com.apple.facebook identifier: B962F897-6BAE-4769-8C04-B1B3D2C872A2 accountDescription: Facebook username: example@yahoo.co.in objectID: x-coredata://EBF41CAD-7388-45E0-8621-3958C7A67491/Account/p1 enabledDataclasses: {( "com.apple.Dataclass.Contacts", "com.apple.Dataclass.Calendars" )} enableAndSyncableDataclasses: {( )} properties: { fullname = "Example"; uid = 100001462475956; } parentAccount: (null) owningBundleID:(null)
当我们点击“使用 Facebook 登录”时我的代码:
-(IBAction)loginWithFacebookClicked:(id)sender
{
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSArray * permissions = [NSArray arrayWithObjects:@"email",@"user_location", nil];
NSDictionary * dict=[NSDictionary dictionaryWithObjectsAndKeys:@"238864112907671",ACFacebookAppIdKey,permissions,ACFacebookPermissionsKey,ACFacebookAudienceEveryone,ACFacebookAudienceKey, nil];
[accountStore requestAccessToAccountsWithType:accountType options:dict completion:^(BOOL granted, NSError *error) {
if(granted ) {
NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
if ([accountsArray count] > 0) {
ACAccount *fbAccount = [accountsArray objectAtIndex:0];
NSLog(@"%@",fbAccount);
}
}
else
{
NSLog(@"%@",[error localizedDescription]);
}
}];
}
最初我遇到了一些错误,例如
Facebook 服务器无法满足此访问请求:被代理的应用程序在事先未安装的情况下无法请求发布权限。
Error Domain=com.apple.accounts Code=7 “Facebook 服务器无法完成此访问请求:无效的应用程序 ID” UserInfo=0xa29f520 {NSLocalizedDescription=Facebook 服务器无法完成此访问请求:无效的应用程序 ID}
后来我通过搜索解决了,但我没有得到解决方案
请指导我在此先感谢
答案很简单! 完成块稍后在任意线程上调用。 因此,如果您逐步进行,它实际上会退出您的方法并继续在主线程上工作,稍后当您收到响应时,它会进入 if 或 else 部分。 您的日志实际上证明您已经输入了 if 部分(它记录了帐户)。 如果您在 if 部分放置一个断点,您会注意到这种行为。 所以你的代码没问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.