Skip to content

Instantly share code, notes, and snippets.

@key
Created December 3, 2013 05:47
Show Gist options
  • Save key/7764471 to your computer and use it in GitHub Desktop.
Save key/7764471 to your computer and use it in GitHub Desktop.
iPhone5sの位置情報水平精度を取得してみた ref: http://qiita.com/key/items/1d196c4ec477f8773cd1
- (id)init
{
self = [super init];
if (self) {
_locationManager = [[CLLocationManager alloc] init];
_locationManager.delegate = self;
[_locationManager startUpdatingLocation];
[Flurry startSession:@"YOUR_FLURRY_API_KEY"];
}
return self;
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
// ログ用のdictionaryを作成
NSDictionary *params = @{
@"latitude": [NSNumber numberWithDouble:newLocation.coordinate.latitude],
@"longitude": [NSNumber numberWithDouble:newLocation.coordinate.longitude],
@"horizontalAccuracy": [NSNumber numberWithDouble:newLocation.horizontalAccuracy], // 水平精度
@"verticalAccuracy": [NSNumber numberWithDouble:newLocation.verticalAccuracy], // 垂直精度
};
// Flurryにログ記録
[Flurry logEvent:@"CLLocation" withParameters:params];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment