这是一个非常粗略的形式,我想这是一个粗暴的解决方案
NSString* str = @"<+10.90180969, +76.19167328> +/- 0.00m (speed -1.00 mps course -1.00) @ 12/04/12 10:18:10 AM India Standard Time";
NSArray* arr = [str componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
if ([arr count] > 1) {
NSString* coordinateStr = [arr objectAtIndex:1];
NSArray* arrCoordinate = [coordinateStr componentsSeparatedByString:@","];
NSLog(@"%@",arrCoordinate);
}
查看字符串显示您正在打印 CLLocation 对象“ someObject ”的描述,您还可以访问纬度和经度,例如
CLLocationCoordinate2D location = [someObject coordinate];
NSLog(@" \nLatitude: %.6f \nLongitude: %.6f",location.latitude,location.longitude);
输出将是:纬度:28.621873 经度:77.388897
但这不会给你符号,即“+”或“-”
希望能帮助到你。