gpt4 book ai didi

iOS Facebook sdk邀请好友请求已发送但未收到好友通知

转载 作者:可可西里 更新时间:2023-11-01 04:39:07 25 4
gpt4 key购买 nike

我正在尝试使用以下方法使用 facebook SDK 从我的 iOS native 应用程序向 Facebook friend 发送应用程序邀请。

-(IBAction)ShowFiendDialog:(id)sender
{

NSDictionary *parameters = @{@"to":@""};

[FBWebDialogs presentRequestsDialogModallyWithSession:FBSession.activeSession
message:@"my message"
title:@"my title"
parameters:parameters
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error)
{
if(error)
{
NSLog(@"Some errorr: %@", [error description]);
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Invitiation Sending Failed" message:@"Unable to send inviation at this Moment, please make sure your are connected with internet" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alrt show];
//[alrt release];
}
else
{
if (![resultURL query])
{
return;
}

NSDictionary *params = [self parseURLParams:[resultURL query]];
NSMutableArray *recipientIDs = [[NSMutableArray alloc] init];
for (NSString *paramKey in params)
{
if ([paramKey hasPrefix:@"to["])
{
[recipientIDs addObject:[params objectForKey:paramKey]];
}
}
if ([params objectForKey:@"request"])
{
NSLog(@"Request ID: %@", [params objectForKey:@"request"]);
}
if ([recipientIDs count] > 0)
{
//[self showMessage:@"Sent request successfully."];
//NSLog(@"Recipient ID(s): %@", recipientIDs);
UIAlertView *alrt = [[UIAlertView alloc] initWithTitle:@"Success!" message:@"Invitation(s) sent successfuly!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alrt show];
//[alrt release];
}

}
}friendCache:nil];

}

- (NSDictionary *)parseURLParams:(NSString *)query
{
NSArray *pairs = [query componentsSeparatedByString:@"&"];
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
for (NSString *pair in pairs)
{
NSArray *kv = [pair componentsSeparatedByString:@"="];

[params setObject:[[kv objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
forKey:[[kv objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}

return params;
}

使用上面的代码,我得到了提示我所有 friend 的列表,在检查了多个或单个 friend 后,该请求已成功发送。但是当我的 friend 在网络或 facebook 本地应用程序中打开 facebook 时,不会收到任何通知或消息。我找不到代码中的错误。

请帮我解决这个问题。我的错误在哪里,我该如何解决?

最佳答案

你必须通过传递一些虚拟 url 在 facebook 上配置你的应用程序,我也遇到了同样的问题,这样做对我有用。转到 developer.facebook.com,选择您的应用程序,选择设置,AddPlatform---> addApplication,在那里传递任何虚拟 url,同时为您的应用程序添加图像,该图像将显示在应用程序详细信息屏幕的通知中。

关于iOS Facebook sdk邀请好友请求已发送但未收到好友通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21926070/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com