我想把facebook账户保存到ACAccountStore in iOS,
accessTocken那里得到facebookSDK,但是怎样才能获得秘密ACAccountStore提前谢谢。
-编辑-编辑
我有一个应用程序,使用facebook登录后,与登录信息需要分享照片,他选择。我的用例是
login method used to authenticate the user must be native iOS 6.0 authentication.。
如果我需要分享由facebook提供的使用facebook应用程序的选项,我不想使用这个选项,因为我希望尽可能避免应用程序切换。如何解决这个问题..。
发布于 2014-01-09 11:58:31
要做到这一点,你应该有一个秘密,
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);
}
}];https://stackoverflow.com/questions/21019064
复制相似问题