用户请求未更新返回的Facebook iOS SDK 3.2图形对象
更新:返回的图形对象似乎没有更新。我已经更改了消息字段,并验证了发送方是否发送了正确的消息(至少它显示在web对话框视图中),但接收方仍在接收旧消息用户请求未更新返回的Facebook iOS SDK 3.2图形对象,ios,facebook,facebook-graph-api,Ios,Facebook,Facebook Graph Api,更新:返回的图形对象似乎没有更新。我已经更改了消息字段,并验证了发送方是否发送了正确的消息(至少它显示在web对话框视图中),但接收方仍在接收旧消息 我在读取通过深度链接返回到应用程序的facebook请求后附加的数据时遇到问题。我遵循了FacebookSDK中的教程,可以发送/接收带有标题和消息的通知请求,但我添加的数据似乎没有显示给接收者。这是我的密码: 发件人: FBSBJSON *jsonWriter = [FBSBJSON new]; NSDictionary *gift =
我在读取通过深度链接返回到应用程序的facebook请求后附加的数据时遇到问题。我遵循了FacebookSDK中的教程,可以发送/接收带有标题和消息的通知请求,但我添加的数据似乎没有显示给接收者。这是我的密码: 发件人:
FBSBJSON *jsonWriter = [FBSBJSON new];
NSDictionary *gift = [NSDictionary dictionaryWithObjectsAndKeys:
@"5", @"social_karma",
@"1", @"badge_of_awesomeness",
nil];
NSString *giftStr = [jsonWriter stringWithObject:gift];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
giftStr, @"data",
nil];
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
NSArray *permissions = [NSArray arrayWithObjects:@"email", @"user_birthday", @"user_photos", nil];
appDelegate.session = [[FBSession alloc] initWithPermissions:permissions];
[appDelegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
NSString *message = [NSString stringWithFormat:@"photoID:%@", self.photoModel.photoID];
// Display the requests dialog
[FBWebDialogs
presentRequestsDialogModallyWithSession:appDelegate.session
message:@"Learn how to make your iOS apps social."
title:@"What do you think? I just rate this person an "
parameters:params
handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
if (error) {
// Error launching the dialog or sending the request.
NSLog(@"Error sending request.");
} else {
if (result == FBWebDialogResultDialogNotCompleted) {
// User clicked the "x" icon
NSLog(@"User canceled request.");
} else {
// Handle the send request callback
NSDictionary *urlParams = [self parseURLParams:[resultURL query]];
if (![urlParams valueForKey:@"request"]) {
// User clicked the Cancel button
NSLog(@"User canceled request.");
} else {
// User clicked the Send button
NSString *requestID = [urlParams valueForKey:@"request"];
NSLog(@"Request ID: %@", requestID);
}
}
}
}];
}];
接收器(应用程序内代表):
同样地,我能够获得消息和标题,而不是数据(参数)
谢谢 更新:返回的图形对象似乎没有得到更新。我刚刚更改了发送者发送的消息,并验证了它是否被发送到facebook,正如它在发送者的web对话框中正确显示的那样,但接收者仍然收到旧消息。知道为什么吗?吉米,你发现了什么?原来我没有清除facebook上的警报。因此,同样的旧警报不断出现。
- (void) notificationGet:(NSString *)requestid {
NSArray *permissions = [NSArray arrayWithObjects:@"email", @"user_birthday", @"user_photos", nil];
self.session = [[FBSession alloc] initWithPermissions:permissions];
[self.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
[FBSession setActiveSession:self.session];
[FBRequestConnection startWithGraphPath:requestid
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (!error) {
NSString *title;
NSString *message;
if ([result objectForKey:@"data"]) {
title = [NSString
stringWithFormat:@"%@ sent you a gift",
[[result objectForKey:@"from"]
objectForKey:@"name"]];
FBSBJSON *jsonParser = [FBSBJSON new];
NSDictionary *requestData =
[jsonParser
objectWithString:[result objectForKey:@"data"]];
message =
[NSString stringWithFormat:@"Badge: %@, Karma: %@",
[requestData objectForKey:@"badge_of_awesomeness"],
[requestData objectForKey:@"social_karma"]];
} else {
title = [NSString
stringWithFormat:@"%@ sent you a request",
[[result objectForKey:@"from"] objectForKey:@"name"]];
message = [NSString stringWithString:
[result objectForKey:@"message"]];
}
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:title
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil,
nil];
[alert show];
}
}];
}];
}