본문 바로가기

개발도구/iOS - 아이폰 개발

[아이폰] CLLocationDegrees < - > NSString

위치 값 - CLLocationDegrees 스트링 형식의 디비에 넣거나 web전송을 위해 형변환은 필수이다

CLLocationDegrees - > NSString

NSNumber *firstNumber = [NSNumber numberWithInt:123456789];
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle];
NSString *convertNumber = [formatter stringForObjectValue:firstNumber];
NSLog(@"value : %@", convertNumber);
또는
1. NSLog(@"Value: %f", currentLocation.coordinate.latitude); //Tried with all NSLog specifiers.
2. NSNumber *tmp = [[NSNumber alloc] initWithDouble:currentLocation.coordinate.latitude];
3. NSString *tmp = [[NSString alloc] initWithFormat:@"%@", currentLocation.coordinate.latitude];
NSString - > CLLocationDegrees

CLLocationDegrees lat = [ufeedJobLatitude doubleValue];

CLLocationDegrees lon = [ufeedJobLongitude doubleValue];