iOS用FacebookSDKのFacebook開発者サイトのチュートリアルの指示に従ってFacebookマルチクエリを実行しようとしています。以下は、iOSアプリにあるコードです。
-(BOOL) FBGetFriendList
{
if (FBSession.activeSession.isOpen)
{
// Multi-query to fetch the active user's friends
// Initial query is stored in reference named "friends"
// Second query picks up the "uid2" info from the first query
// and gets the friend details.
NSString *query =
@"{"
@"'friends':'SELECT uid2 FROM friend WHERE uid1 = me()',"
@"'friendinfo':'SELECT uid, name, pic_square FROM user WHERE is_app_user = 1 AND uid IN (SELECT uid2 FROM #friends)',"
@"}";
// Setup the query parameter
NSDictionary *queryParam = [NSDictionary dictionaryWithObjectsAndKeys:query, @"q", nil];
// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql"
parameters:queryParam
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *_connection, id _result, NSError *_error) {
// check for errors here
if (_error)
{
NSLog(@"FacebookSDKPlugin > FBGetFriendList() > request error!");
}
else
{
@synchronized(friendList)
{
if (friendList == nil)
{
friendList = [[NSMutableArray alloc] init];
}
else
{
[friendList removeAllObjects];
}
NSArray *facebookData = [(NSDictionary *)_result objectForKey:@"data"];
int count = facebookData.count;
for (int i = 0; i < count; ++i)
{
NSDictionary<FBGraphUser> *tempObject = [facebookData objectAtIndex:i];
FacebookFriend *tempFriend = [[FacebookFriend alloc] initWithID:[tempObject.id copy] name:[tempObject.name copy]];
[friendList addObject:tempFriend];
}
}
}
}];
return YES;
}
return NO;
}
ただし、コンパイル中に警告があります。
Class method '+startWithGraphPath:parameters:HTTPMethod:completionHandler:' not found (return type defaults to 'id')
私はエラーを無視してiPad2でコンパイルしましたが、このエラーでクラッシュしました:
2012-09-03 11:53:13.377 +[FBRequestConnection startWithGraphPath:parameters:HTTPMethod:completionHandler:]: unrecognized selector sent to class 0xa05350
2012-09-03 11:53:13.379 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[FBRequestConnection startWithGraphPath:parameters:HTTPMethod:completionHandler:]: unrecognized selector sent to class 0xa05350'
「FBRequest.h」と「Facebook.h」を含めましたが、「FBRequest.h」でメソッドを確認できます。しかし、コンパイラが関数を見つけられない理由がわかりません。誰かがこの問題を解決する方法を知っていますか?