Facebook ile kimlik doğrulama için facebook SDK kullandım. facebook hesabı sonraACAccountType her zaman 0 hesap görüntüleniyor
NSArray *fbAccounts=nil;
ACAccountType *accountTypeFB;
if ((_accountStore = [[ACAccountStore alloc] init]) &&
(accountTypeFB = [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook])){
fbAccounts = [_accountStore accountsWithAccountType:accountTypeFB];
NSLog(@" %d fbAccounts",[fbAccounts count]);
}
if ([fbAccounts count]!=0) {
[FBSession openActiveSessionWithAllowLoginUI:YES];
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"email",
nil];
[FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
if (error) {
NSLog(@"Failure");
NSLog(@"error %@",error);
}
else
{
NSLog(@" active session opened ");
if (self.gotUserDetails)
{
return;
}
[self fetchuserinfo];
}
}];
}
}
Bu etkinleştirildiğinde aksi takdirde daha sonra düğme uygulamalar üzerinde tıklayarak ayarlarında etkinleştirilmiş hiçbir facebook hesabı
if (appDelegate.session.state != FBSessionStateCreated)
{
appDelegate.session = [[FBSession alloc] init];
}
[appDelegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// and here we make sure to update our UX according to the new session state
[self updateView];
}];
yani kimlik doğrulaması için safari gidildiği zaman kullanıcı bilgilerine erişmek için uyarıyı gösteren resim. Simülatörde iyi çalışıyor. Ancak cihazda her zaman safari gider veya facebook hesabında kimlik doğrulama için facebook hesabı bile ayarlarda etkinleştirilir. Lütfen bu sorunu bulmak için bana yardımcı olun.
Herkese teşekkürler.
'requestAccessToAccountsWithType: options: completion: '? – Wain
@Wain Nerede arayayım? –