iphone - 如何使用 Facebook Open graph api for fitness 步行通过 FacebookSDK

标签 iphone ios objective-c facebook-opengraph

我想在 Facebook 上发布一个 Open Graph fitness:walk Action ,我希望它用我的路径图呈现。我该怎么做呢?下面的方法发布了操作,我可以在我的 Facebook 事件日志和时间轴中看到操作的文本。但是当我将鼠标悬停在已发布操作的任何元素上时,我没有看到 map 。我做错了什么?

NSMutableDictionary<FBGraphObject> *action = [FBGraphObject graphObject];action[@"course"] = @"http://samples.ogp.me/136756249803614";

[FBRequestConnection startForPostWithGraphPath:@"me/fitness.walks"
                                   graphObject:action
                             completionHandler:^(FBRequestConnection *connection,
                                                 id result,
                                                 NSError *error) {
                                 // handle the result
                                 NSLog(@"error:%@",error.description);

                                 NSLog(@"Result:%@",result);
                             }];

最佳答案

试试这个

   [FBRequestConnection startForPostWithGraphPath:[NSString stringWithFormat:@"me/fitness.%@?access_token=%@",walkType,appDelegate.session.accessTokenData.accessToken]
                                       graphObject:action
                                 completionHandler:^(FBRequestConnection *connection,
                                                     id result,
                                                     NSError *error)
                                {
                                     // handle the result
                                     //NSLog(@"error description:%@",error);
                                     NSLog(@"Result:%@",result);
                                     [SVProgressHUD dismiss];
                                    if (error == nil)
                                    {
                                        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Track My Walks" message:[NSString stringWithFormat:@"You successfully post a route and your id is:%@",[result valueForKey:@"id"]] delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
                                        [alert show];
                                    }
                                    else
                                    {
                                        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Track My Walks" message:error.description delegate:self cancelButtonTitle:@"ok" otherButtonTitles:nil, nil];
                                        [alert show];
                                    }

                                 }];
}];
[request setFailedBlock:^{
    [SVProgressHUD dismiss];
    NSError *error = [request error];
    NSLog(@"Error: %@", error.localizedDescription);
    [self directionsDidFailedDirections:error.localizedDescription];
}];

[request startAsynchronous];

关于iphone - 如何使用 Facebook Open graph api for fitness 步行通过 FacebookSDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16186051/

相关文章:

iphone - 在 iOS Safari 上更改方向时出现白色闪烁

objective-c - iOS 上的 Autocad 格式查看器

objective-c - iOS/Objective C- 来自 NSMutableURLRequest 的空响应

iphone - UITextInput setMarkedText :selectedRange not working?(不可能!)

ios - 当应用程序直接在设备中运行并创建 ipa 文件时,为什么设备 token 生成不同?

ios - 从 WatchKit 触发 UILocalNotification

ios - UIBezierPath 描边 1px 线和填充 1px 宽度矩形 - 不同的结果。

ios - UIPageViewController : Scroll Delegate

ios - UITableView headerView 滚动偏移量

iphone - 设置设备音量 - UILocalNotification - iphone 处于静音模式