At the moment my application allows users to first save a location, called an event
to Parse. Then the user can press a button to retrieve all of the stored locations from Parse, which are put into an array using the following code:
-(void) retrieveEventsFromParse {
PFQuery *query = [PFQuery queryWithClassName:@"events"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
eventsArray =[[NSMutableArray alloc] initWithArray: objects];
if (!error) {
NSLog(@"Successfully retrieved %lu locations.", (unsigned long)objects.count);
// Do something with the found objects
for (PFObject *object in objects) {
NSString *location = [object objectForKey:@"location"];
NSLog(@"object with id %@ has location %@", object.objectId, location);
}
} else {
// Log details of the failure
NSLog(@"Error: %@ %@", error, [error userInfo]);
}
}];
}
I am having trouble, however, displaying these retrieved locations as pins on a map. I was wondering how would I turn one of the array objects (example below) into a pin on the map.
\"<-27.47143300,+153.02720500> +/- 0.00m (speed -1.00 mps / course -1.00) @ 6/26/15, 9:47:11 AM Australian Eastern Standard Time\";\n}"
I thought of using Regex to cut out long,lat but I honestly have no idea as to how to approach this. Any help is much appreciated.