我设法恢复了下面代码中指定的所有信息,但我无法检索user.location的纬度和经度。
- (void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user {
NSString *fbUsername = [NSString stringWithFormat:@"%@",user.username];
NSString *fbNickname = [NSString stringWithFormat:@"%@",user.name];
NSString *fbName = [NSString stringWithFormat:@"%@",user.first_name];
NSString *fbSurname = [NSString stringWithFormat:@"%@",user.last_name];
NSString *fbLocation = [NSString stringWithFormat:@"%@",user.location.name];
}
请帮助我!
答案 0 :(得分:1)
要获取用户的经度和经度,请在您发布的方法中尝试:
NSNumber *userLatitude = user.location.location.latitude;
NSNumber *userLatitude = user.location.location.latitude;
//do whatever you want with the values here
答案 1 :(得分:0)
- (void)placePickerViewControllerSelectionDidChange:(FBPlacePickerViewController *)placePicker
{
// id<
// FBGraphPlace>
place = placePicker.selection;
// we'll use logging to show the simple typed property access to place and location info
NSLog(@"place=%@, city=%@, state=%@, lat long=%@ %@",
place.name,
place.location.city,
place.location.state,
place.location.latitude,
place.location.longitude);
}