Tweets posted with MGTwitterEngine lose location coordinates?
I am using sendUpdate:withLatitude:longitude:
to post a tweet containing the user's location in an iPhone app. However, this metadata seems to get lost in the process, in that no such tweets that I view have any indication of any location data at all. Is there another step I have to go through in order to properly开发者_StackOverflow中文版 post geotagged tweets?
Why don't you check if Twitter account is enabled to show location data. When you signed up Twitter, this feature is usually turned on, but the user can opt out very easily. If this is disabled, even if you send proper latitude and longitude, they are ignored and your tweet will not show location.
Also, make sure your device properly gives you the right coordinate information. If it's not working properly, the coordinate values are often 0.00000000, 0.00000000 which is still accepted as valid.
MGTwitterEngine is kind enough to check if you're providing proper values, but it doesn't catch 0.00000000, 0.00000000 coordinate, because it passes the following evaluation
if (latitude >= -90.0 && latitude <= 90.0 && longitude >= -180.0 && longitude <= 180.0) {
[params setObject:[NSString stringWithFormat:@"%.8f", latitude] forKey:@"lat"];
[params setObject:[NSString stringWithFormat:@"%.8f", longitude] forKey:@"long"];
}
精彩评论