ios - 设置 Facebook 图形 checkin 的坐标参数
<p><p>我正在使用 Facebook SDK 实现 Checkins Facebook Graph API。这是签到的代码</p>
<pre><code>NSDictionary *dict=;
[FBRequestConnection startWithGraphPath:@"/me/checkins"
parameters:dict
HTTPMethod:@"POST"
completionHandler:^(
FBRequestConnection *connection,
id result,
NSError *error
) {
NSLog(@"Error...%@",error);
}];
</code></pre>
<p>当我尝试上面的代码时。它给了我以下错误:</p>
<pre><code>error = {
code = 160;
message = "(#160) Invalid coordinates.Coordinates must contain at least latitude and longitude.";
type = OAuthException;
};
</code></pre>
<p>它给出了坐标问题。有没有不同的方法来传递坐标参数?请帮我解决这个问题。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>据我所知,checkins 已被弃用,您应该使用带有 place 参数的 post。</p>
<p>这是链接。 <a href="https://developers.facebook.com/docs/ios/graph#postingobjects" rel="noreferrer noopener nofollow">Facebook SDK reference</a> </p>
<p>编辑:对于懒得检查链接的人,有来自 Facebook 的示例代码。</p>
<pre><code>// Create an object
NSMutableDictionary<FBOpenGraphObject> *restaurant = ;
// 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 = ;
alertTitle = @"Object successfully created";
alertText = ;
[[ 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
}
}];
</code></pre></p>
<p style="font-size: 20px;">关于ios - 设置 Facebook 图形 checkin 的坐标参数,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/22834565/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/22834565/
</a>
</p>
页:
[1]