Ios 如何从facebookSDK将facebook帐户保存到AccountStore
我想在iOS中将facebook帐户保存到Ios 如何从facebookSDK将facebook帐户保存到AccountStore,ios,facebook,acaccount,acaccountstore,facebook-sdk-3.1,Ios,Facebook,Acaccount,Acaccountstore,Facebook Sdk 3.1,我想在iOS中将facebook帐户保存到ACAccountStore 我将从facebooksk获得accessTocken,但如何获得tocken和secret 如何将其保存到ACAccountStore 提前谢谢 ------编辑-------- 我有一个应用程序,使用facebook登录,登录信息后需要共享他选择的照片。 我的用例是 如果帐户已经在设置应用程序中,那么我可以使用它进行登录和共享 用户使用safari或webview登录,然后我如何继续共享 a。facebook SDK表示
ACAccountStore
accessTocken
,但如何获得tocken和secretACAccountStore
如何解决此问题。要做到这一点,您应该拥有accesstoken和secret
if (self.accountStore == nil) {
self.accountStore = [[ACAccountStore alloc] init];
}
//make credentials to assign to ACAccount
ACAccountCredential *credential = [[ACAccountCredential alloc] initWithOAuthToken:accesstoken tokenSecret:secret];
ACAccountType *acctType =[self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
ACAccount *newAccount = [[ACAccount alloc] initWithAccountType:acctType];
newAccount.credential = credential;
NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:
"xXXXXXX", (NSString *)ACFacebookAppIdKey,
[NSArray arrayWithObject:@"basic_info"], (NSString *)ACFacebookPermissionsKey,
ACFacebookAudienceEveryone, (NSString *)ACFacebookAudienceKey,
nil];
[_accountStore requestAccessToAccountsWithType:acctType options:options completion:^(BOOL granted, NSError *error) {
if (granted == YES) {
[self.accountStore saveAccount:newAccount withCompletionHandler:^(BOOL success, NSError *error) {
if (success) {
NSLog(@"the account was saved!");
}
else {
if ([error code] == ACErrorPermissionDenied) {
NSLog(@"Got a ACErrorPermissionDenied, the account was not saved!");
}
NSLog(@"%@",error);
}
}];
}
else {
NSLog(@"%@ ",error);
}
}];
我将如何获得那个秘密和令牌?。我有accessToken.NSString*accessToken=[[FBSession.activeSession accessTokenData]accessToken];我说我有accessToken,但如何区分token和secret?在twitter和accessToken中,我们需要区分token和secret。facebook上也一样吗?怎么办?对不起,我在开会。我想这里不需要保密。试着不用它@“”单独保存访问令牌的动机是什么?需要将facebook帐户信息保存到设置应用程序,然后只有我才能使用social framework与该帐户共享…如果您使用facebook SDK,它会自动为您保存会话信息。为什么不使用SDK提供的API来共享而不是使用社交框架呢?如果我需要与facebook SDK共享,我需要在那里安装facebook应用程序,需要进行应用程序切换。我试图显示OS integrated Dialog,但我遇到了如下错误
Error Domain=com.facebook.sdk code=7“操作无法完成。(com.facebook.sdk错误7.)”com.facebook.sdk:DialogReasonKey=com.facebook.sdk:DialogNotSupported