[英]iOS - Can't send Facebook requests
我的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上共享它,並且效果很好。
非常感謝! :)
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
}
}];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.