我正在制作一个“FBRequestConnection”来吸引玩游戏的所有朋友......
当我将Facebook的SDK更新到最后一个时,这将停止工作。因为它之前有用。
我没有回应,没有成功,没有错误。有什么想法吗?
NSString *query = @"SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user = 1";
// Set up 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) {
if (error) {
[self debug:[NSString stringWithFormat:@"Error: %@", [error localizedDescription]]];
} else {
[self debug:[NSString stringWithFormat:@"Result: %@", [result objectForKey:@"data"]]];
}
}];
-(void)fbLogin {
if (!_session.isOpen) {
// create a fresh session object
_session = [[FBSession alloc] init];
// if we don't have a cached token, a call to open here would cause UX for login to
// occur; we don't want that to happen unless the user clicks the login button, and so
// we check here to make sure we have a token before calling open
if (_session.state == FBSessionStateCreatedTokenLoaded) {
// even though we had a cached token, we need to login to make the session usable
[_session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// we recurse here, in order to update buttons and labels
[[NSNotificationCenter defaultCenter] postNotificationName:@"fbConnected" object:nil];
}];
}
[self populateUserDetails];
}
}
由于
答案 0 :(得分:1)
使用以下命令打开会话:
[FBSession.activeSession openWithCompletionHandler:^(FBSession * session, FBSessionState state, NSError * error){
if (!error){
}
}];