0
我想取facebook的朋友名單&發送邀請我的應用程序。邀請Facebook朋友在IOS6
我嘗試下面的代碼:
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSArray *accounts = [accountStore accountsWithAccountType:facebookAccountType];
NSLog(@"%@",accounts); `******//I got the null array ***********`
ACAccount *facebookAccount = [accounts lastObject];
NSString *acessToken = [NSString stringWithFormat:@"%@",facebookAccount.credential.oauthToken];
NSDictionary *parameters = @{@"access_token": acessToken};
NSURL *feedURL = [NSURL URLWithString:@"https://graph.facebook.com/me/friends"];
SLRequest *feedRequest = [SLRequest
requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:feedURL
parameters:parameters];
feedRequest.account = facebookAccount;
[feedRequest performRequestWithHandler:^(NSData *responseData,
NSHTTPURLResponse *urlResponse, NSError *error)
{
NSLog(@"%@",[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
}];
你的問題是什麼?很難從一團糟的代碼中分辨出來。你能否詳細說明你的問題? – Michal 2013-05-07 11:49:30
@Michal,謝謝你的回覆!正如你在上面看到的,我得到的帳戶數組爲null。所以,我無法獲得Facebook好友列表和電子郵件以發送應用程序的邀請。 – user2357044 2013-05-07 12:28:56