不使用后端服务器发布操作

时间:2013-04-22 05:42:47

标签: ios facebook facebook-graph-api

我正在将此代码用于我的facebook请求,该请求会将图片和文字发布到用户的Feed:

我的问题是,如何为位置添加参数?我遵循了本教程:https://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/show-nearby-places/

但我无法使用后端服务器。在我不想使用后端服务器的情况下,如何在不使用后端服务器的情况下修改我的代码以发布故事,包括位置(最好链接到facebook位置)?我让用户选择这个地方,并且完美无瑕。目前我有兴趣在不使用后端服务器的情况下使用“在Patxi的Chicago Pizza”。这可能吗?

enter image description here

NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
[params setObject:self.textViewForComments.text forKey:@"message"];

//DLog(@"%@",[params objectForKey:@"message"]);

if(self.capturedImageAtFullResolution){

    DLog(@"not null");

    [params setObject:UIImagePNGRepresentation(self.capturedImageAtFullResolution) forKey:@"picture"];

    /*
    if(canPostSmileysImage){ //##

        //[params setObject:UIImagePNGRepresentation([self takeScreenShot]) forKey:@"picture"];

    } else {

    }
    */


    [self performPublishAction:^{


        [FBRequestConnection startWithGraphPath:@"me/photos"
                                     parameters:params
                                     HTTPMethod:@"POST"
                              completionHandler:^(FBRequestConnection *connection,
                                                  id result,
                                                  NSError *error)
         {
             if (error)
             {
                 //showing an alert for failure
                 DLog(@"%@",error);

                 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                                 message:@"unable to post"
                                                                delegate:nil
                                                       cancelButtonTitle:@"OK"
                                                       otherButtonTitles:nil];
                 [alert show];

             }
             else
             {
                 //showing an alert for success
                 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Posted!"
                                                                 message:@""
                                                                delegate:nil
                                                       cancelButtonTitle:@"OK"
                                                       otherButtonTitles:nil];
                 [alert show];
             }


         }];

    }];



}

0 个答案:

没有答案