ユーザーのプロフィール写真を取得する機能を構築しています。Facebook の FBSDKGraphRequest を使用していますが、取得したデータを使用して画像に割り当てようとすると、理解できないエラーが表示されます。Variable is not assignable (missing _block type specifier)
私の機能は以下の通りです:
- (UIImage *)getProfilePicture: (NSString *)ID
{
FBSDKGraphRequest *requestFriends = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me/friends" parameters:@{@"fields": @"name"}];
FBSDKGraphRequestConnection *connection = [[FBSDKGraphRequestConnection alloc] init];
//[connection addRequest:requestFriends completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error)
UIImage* profilePic;
NSString* requestPath = @"me/?fields=name,location,gender,birthday,relationship_status,picture,email,id";
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:@{@"fields": @"picture"}];
[connection addRequest:request completionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError* error)
{
NSDictionary* data = (NSDictionary *)result;
NSDictionary* picture = [data objectForKey:@"picture"];
NSDictionary* pictureData = [picture objectForKey:@"data"];
NSString* pictureURL = [pictureData objectForKey:@"url"];
profilePic = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:pictureURL]]];
}];
return profilePic;
}