I currently have a problem with my iOS application because I don't seem to be able to send requests to people... Here is the code that I have:
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];
}
}];
}
}];
}
Every time I get a I get a request ID but nothing on the account. I looked at the sample in the Facebook SDK and I seem to have exactly the same. However, it works with the sample and not with my code. Is there anything to change somewhere? Is it something on developers.facebook.com? Request: (null)
.
Edit: I forgot to say that in the same application I use a SLComposeViewController to share on Facebook and it works perfectly.
Thanks a lot! :)
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
}
}];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.