I'm relatively new to iOS dev and completely new to using the Google Maps API.
I have two separate views that I want to have a mapview. The first one is a scene that allows you to find a location on the map, enter in an address, or use your current location. In the next scene, I want to use the same location that the user input from the previous scene, but rather than the regular map I want to use the satellite view, and there will be some additional tools to manipulate the map to serve the purposes of my app.
I need to have two separate scenes, as the interfaces are very different, but I'm having trouble sending the information from one mapview to the other. Here's a few methods that I've tried(two are commented out):
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"showServiceArea"]) {
ServiceAreaViewController *destViewController = segue.destinationViewController;
destViewController.camera = [GMSCameraPosition cameraWithLatitude:curLocation.location.coordinate.latitude longitude:curLocation.location.coordinate.longitude zoom:17]; //Setting up a camera in the next scene using the curLocation coordinates from the current view
//destViewController.view = _mapView; //Setting the next view controller's view to the current mapView and changing the mapType to satellite
//_mapView.mapType = kGMSTypeSatellite;
//destViewController.serviceAreaMapView = _mapView; //copying the current mapview to a mapview on the next scene
//destViewController.serviceAreaMapView.mapType = kGMSTypeSatellite;
}
}
Every method that I've tried has thrown an exception and caused my app to crash. Here's the output from the crash of the above code:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setCamera:]: unrecognized selector sent to instance 0x17e73eb0'
For the first two commented out methods, I figured that by the time the next scene was loaded, the data I had assigned to the next view was being deleted. I'm not sure what is wrong with my current code.
Could anybody point me in the right direction to produce a mapView in a following scene using the current scene's data? Thanks.