My iOS app uses the information provided by Apple, here, to get various location information about my user. cllocationmanager provides a method for getting location information about the user every-time it changes based on certain parameters:
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
This method is absolutely amazing, and returns all of the data I need, however it returns it as a single value in an NSArray:
<+37.33069626,-122.02967106> +/- 10.00m (speed 3.62 mps / course 82.41) @ 2/3/13, 4:42:58 PM Eastern Standard Time
This has all the information I need (by the way, what does the course variable stand for), but I can’t figure out how to get it into a more usable form. By usable form, I mean simply the coordinates, time, speed, etc. all in separate NSString / NSDictionary / NSArray values. How can I split the single NSArray value (shown above) into different parts?
I’ve tried splitting the single NSArray value here using nspredicate, but I could only get the NSPredicate to return a boolean value.
I’ve tried splitting it with the componentsJoinedByString method, however that can only split the array value with one string and there’s no single string that every value can be consistently split by.
Any suggestions on how I can split up the pieces of data given to my iOS app through CLLocationManager? Are there methods or functions which could retrieve / split the same data in a more usable form.
Edit
It seems there was a misunderstanding both on my part and others. I had thought that the CLLocation object was an NSArray object with one value. However, as I learned in the comments (thank you @holex) it is not.
According to this part of the doc, the array contains CLLocations objects. So, just retrieve and process them.