दिखा रहा है मैंने फेसबुक के साथ प्रमाणीकरण के लिए फेसबुक एसडीके का उपयोग किया है। जब कोई फेसबुक खाता फिर बटन क्षुधा पर क्लिक करके सेटिंग में सक्षम यानीACAccountType हमेशा 0 खाते
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];
}];
प्रमाणीकरण के लिए सफ़ारी जाता है अन्यथा यदि फेसबुक खाता तो सक्षम किया गया है
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];
}
}];
}
}
यह छवि उपयोगकर्ता जानकारी तक पहुंचने के लिए अलर्ट दिखा रही है। यह सिम्युलेटर में ठीक काम कर रहा है। लेकिन डिवाइस में यह हमेशा सफारी या प्रमाणीकरण के लिए फेसबुक ऐप में जाता है, यहां तक कि सेटिंग में फेसबुक अकाउंट सक्षम है। इस मुद्दे को खोजने के लिए कृपया मेरी मदद करें।
सभी के लिए धन्यवाद।
क्या आपने 'requestAccessToAccountsWithType: विकल्प: समापन:' कहा है? – Wain
@Wain मुझे इसे कहां कॉल करना चाहिए? –