나는 사용자 정보를 가져 오기 위해 노력하고 있지만 images.This를 가져올 수 현재 드릴 수 없습니다입니다 나는 점점 오전 오류입니다 현재 사용자에 대한 정보를 조회하는 데 사용되어야합니다활성 액세스 토큰은
{
error = {
code = 2500;
message = "An active access token must be used to query information about the current user.";
type = OAuthException;
};
}
이것은 내 코드 :
if(!self.store)
{
ACAccountStore *store1 = [[ACAccountStore alloc] init];
self.store=store1;
[store1 release];
}
ACAccountType *fbAccountType =
[store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSArray * permissions = @[@"read_stream", @"publish_stream",@"email", @"user_birthday",@"publish_actions",@"user_photos"];
NSDictionary * dict = @{ACFacebookAppIdKey : @"my_key", ACFacebookPermissionsKey : permissions, ACFacebookAudienceKey : ACFacebookAudienceOnlyMe};
// Request permission from the user to access the available Twitter accounts
[store requestAccessToAccountsWithType:fbAccountType options:dict completion:^(BOOL granted, NSError *error) {
__block NSString * statusText = nil;
if (granted) {
statusText = @"Logged in";
NSArray * accounts = [store accountsWithAccountType:fbAccountType];
store = [accounts lastObject];
account = [accounts objectAtIndex:0];
NSLog(@"account is: %@", account);
NSURL *requestURL = [NSURL URLWithString:@"https://graph.facebook.com/me?fields=picture"];
SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:requestURL
parameters:nil];
request.account = account;
[request performRequestWithHandler:^(NSData *data,
NSHTTPURLResponse *response,
NSError *error) {
if(!error){
NSDictionary *list =[NSJSONSerialization JSONObjectWithData:data
options:kNilOptions error:&error];
NSLog(@"Dictionary contains: %@", list);
}
else{
//handle error gracefully
}
}];
}
URL로 https://graph.facebook.com/me을 사용하면 정상적으로 작동합니다. 하지만 프로필 사진이 필요합니다. 무엇을해야합니까?
오류로 인해 액티브 액세스 토큰을 전달하지 못했다고합니다. 그 일을 시도하십시오 –
어디서 토큰을 통과해야합니까? 그리고 내가 https://graph.facebook.com/me 대신 https://graph.facebook.com/me?fields=picture를 쿼리하면 제대로 작동합니다. –
내 대답이 도움이됩니까? –