3

我想在 Facebook 上发布一个 Open Graph Fitness:walk 动作,并希望它与我的路径图一起呈现。我该怎么做呢?下面的方法发布了操作,我可以在 Facebook 上的活动日志和时间轴中看到操作的文本。但是当我将鼠标悬停在已发布操作的任何元素上时,我看不到地图。我究竟做错了什么?

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);
                             }];
4

1 回答 1

1

尝试这个

   [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];
于 2013-06-21T12:41:09.753 回答