我目前的iOS应用程序存在问题,因为我似乎无法向人们发送请求... 这是我的代码:
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:nil];
if([FBSession activeSession].isOpen) {
[FBWebDialogs presentRequestsDialogModallyWithSession:[FBSession activeSession] message:@"Join me." title:@"Invite" parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
NSLog(@"%@", [FBSession activeSession]);
if (error)
NSLog(@"Error sending request.");
else {
if (result == FBWebDialogResultDialogNotCompleted)
NSLog(@"User canceled request.");
else if(result == FBWebDialogResultDialogCompleted)
NSLog(@"Request: %@", resultURL);
else
NSLog(@"Error unknown.");
}
}];
}
else {
[FBSession openActiveSessionWithReadPermissions:@[@"email"] allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
if(session.isOpen) {
[FBSession openActiveSessionWithPublishPermissions:@[@"publish_actions"] defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
if(session.isOpen) {
[self showRequestForFacebook];
}
}];
}
}];
}
每次收到 我都会收到一个请求ID,但帐户上没有任何内容。我查看了Facebook SDK中的示例似乎完全一样。但是,它适用于示例而不是我的代码。
有什么地方可以改变吗?它是在developers.facebook.com上的吗?Request: (null)
。
编辑:我忘了说在同一个应用程序中我使用SLComposeViewController在Facebook上分享,它运行良好。
非常感谢! :)
答案 0 :(得分:0)
NSString *query2 = [NSString stringWithFormat:@"SELECT uid, name, pic_square,is_app_user FROM user WHERE is_app_user = 1 AND uid IN " @"(SELECT uid2 FROM friend WHERE uid1 = me())"];
// Set up the query parameter
NSDictionary *queryParam2 = @{ @"q": query2 };
// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql" parameters:queryParam2 HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error)
{
if (error) {
} else {
// NSLog(@"Result: %@", result);
// Get the friend data to display
NSArray *friendInfo = (NSArray *) result[@"data"];
NSLog(@"%@",friendInfo);
self.data=friendInfo;
[self constructDictionaryOfNumbers];
// Show the friend details display
}
}];
}