Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/103.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 设置facebook图形签入的坐标参数_Ios_Objective C_Facebook_Facebook Graph Api - Fatal编程技术网

Ios 设置facebook图形签入的坐标参数

Ios 设置facebook图形签入的坐标参数,ios,objective-c,facebook,facebook-graph-api,Ios,Objective C,Facebook,Facebook Graph Api,我正在使用Facebook SDK实现签入Facebook图形API。这是签入的代码 NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys:accsstoken,@"access_token",@"253651184683030",@"place",@"I m here in this place",@"message",@"30.893075018178,75.821777459326",@"coordinates", ni

我正在使用Facebook SDK实现签入Facebook图形API。这是签入的代码

NSDictionary *dict=[NSDictionary dictionaryWithObjectsAndKeys:accsstoken,@"access_token",@"253651184683030",@"place",@"I m here in this place",@"message",@"30.893075018178,75.821777459326",@"coordinates", nil];

        [FBRequestConnection startWithGraphPath:@"/me/checkins"
                                     parameters:dict
                                     HTTPMethod:@"POST"
                              completionHandler:^(
                                                  FBRequestConnection *connection,
                                                  id result,
                                                  NSError *error
                                                  ) {
                                  NSLog(@"Error...%@",error);

                              }];
当我尝试上面的代码时。它给了我以下错误:

error =         {
            code = 160;
            message = "(#160) Invalid coordinates.  Coordinates must contain at least latitude and longitude.";
            type = OAuthException;
        };

它给出了坐标问题。是否有其他方法传递坐标参数?请帮我解决这个问题。

据我所知,签入已被弃用,您应该使用post with place参数

这里是链接

编辑:对于懒得查看链接的人,这里有来自Facebook的示例代码

// Create an object
NSMutableDictionary<FBOpenGraphObject> *restaurant = [FBGraphObject openGraphObjectForPost];

// specify that this Open Graph object will be posted to Facebook
restaurant.provisionedForPost = YES;

// Add the standard object properties
restaurant[@"og"] = @{ @"title":@"Restaurant Name", @"type":@"restaurant.restaurant", @"description":@"a description", @"image":image };

// Add the properties restaurant inherits from place
restaurant[@"place"] = @{ @"location" : @{ @"longitude": @"-58.381667", @"latitude":@"-34.603333"} };

// Add the properties particular to the type restaurant.restaurant
restaurant[@"restaurant"] = @{@"category": @[@"Mexican"],
                         @"contact_info": @{@"street_address": @"123 Some st",
                                            @"locality": @"Menlo Park",
                                            @"region": @"CA",
                                            @"phone_number": @"555-555-555",
                                            @"website": @"http://www.example.com"}};

// Make the Graph API request to post the object
FBRequest *request = [FBRequest requestForPostWithGraphPath:@"me/objects/restaurant.restaurant"
                                                graphObject:@{@"object":restaurant}];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
  if (!error) {
    // Sucess! Include your code to handle the results here
    NSLog(@"result: %@", result);
    _objectID = [result objectForKey:@"id"];
    alertTitle = @"Object successfully created";
    alertText = [NSString stringWithFormat:@"An object with id %@ has been created", _objectID];
    [[[UIAlertView alloc] initWithTitle:alertTitle
                                message:alertText
                               delegate:self
                      cancelButtonTitle:@"OK!"
                      otherButtonTitles:nil] show];
  } else {
    // An error occurred, we need to handle the error
    // See: https://developers.facebook.com/docs/ios/errors   
  }
}];
//创建一个对象
NSMutableDictionary*restaurant=[FBGraphObjectOpenGraphObjectForPost];
//指定此打开的图形对象将发布到Facebook
restaurant.provisionedForPost=是;
//添加标准对象属性
餐厅[@“og”]=@{@“标题”:@“餐厅名称”@“类型”:@“餐厅.餐厅”@“描述”:@“描述”@“图像”:图像};
//添加餐厅从place继承的属性
餐厅("地点":"经度":"58.381667","纬度":"34.603333";;
//将特定属性添加到类型restaurant.restaurant
餐厅[@“餐厅”]=@{@“类别”:@[@“墨西哥”],
@"联络资料:"街道地址:"123 Some st",,
@“地点”:“门罗公园”,
@“地区”:@“CA”,
@“电话号码”:@“555-555-555”,
@“网站”:http://www.example.com"}};
//发出图形API请求以发布对象
FBRequest*request=[FBRequestForPostWithGraphPath:@“me/objects/restaurant.restaurant”
graphObject:@{@“object”:餐厅}];
[请求startWithCompletionHandler:^(FBRequestConnection*连接,id结果,NSError*错误){
如果(!错误){
//成功!在此处包含处理结果的代码
NSLog(@“结果:%@”,结果);
_objectID=[result objectForKey:@“id”];
alertTitle=@“已成功创建对象”;
alertText=[NSString stringWithFormat:@“已创建id为%@的对象”;
[[[UIAlertView alloc]initWithTitle:alertTitle
信息:alertText
代表:赛尔夫
取消按钮:@“好的!”
其他按钮:无]显示];
}否则{
//发生错误,我们需要处理该错误
//见:https://developers.facebook.com/docs/ios/errors   
}
}];

签入已被弃用,取而代之的是将位置信息附加到帖子上,或在打开的图表故事中标记位置

你可以在这里查阅


不推荐使用发布
签入的可能重复项。