I am trying to install Google Maps API to an app for iOS7. After following Google's guidelines and videos I ended up with the following error: [GMSMapView animateToCameraPosition:]: unrecognized selector sent to instance 0x10b98e6c0
I am using Storyboard, and trying to make this map appears above a TableView in the same viewController.
In this app, I use Parse, which is fetching data to my TableView, and is working fine.
I tried to use a couple of suggestions which I found here on StackOverflow, but the problem persists:
Cannot put a google maps GMSMapView in a subview of main main view?
How to set the frame for mapview - in google GMSMap for iOS6
Apparently the issue is related to this method:
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
When I erases it, the error goes away.
My TestViewController is coded as below(no table or anything, but still not working):
// TesteViewController.m
//
#import "TesteViewController.h"
#import <GoogleMaps/GoogleMaps.h>
#import "AppDelegate.h"
@interface TesteViewController ()
@end
@implementation TesteViewController{
GMSMapView *mapView_;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
// Create a GMSCameraPosition that tells the map to display the
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
longitude:151.20
zoom:6];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.myLocationEnabled = YES;
self.view = mapView_;
// Creates a marker in the center of the map.
GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
marker.title = @"Sydney";
marker.snippet = @"Australia";
marker.map = mapView_;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
I also imported all frameworks, as recommended, and did put -ObjC
into my otherLinkerFlags
, without success.
In addition to that, I tested the process I am using in a new blank project and it worked fine, but, when I try to add a blank viewController
just as a test to the original project, it does not work.
Another test I did, was to add a view to this blank viewController
and try what is stated on StackOverflow's references I posted above.
Has anyone got any suggestions about what is happening?
Maybe a conflict with Parse's framework or some other library?
Instead of using -ObjC
I also tried -force_load $(PROJECT_DIR)/GoogleMaps.framework/GoogleMaps
and the error goes away, it asks me to allow my current position, but the screen does not load.
[GMSMapView animateToCameraPosition:]
? – Adam-force_load $(PROJECT_DIR)/GoogleMaps.framework/GoogleMaps
the crash goes away, it asks my current location, but it does not load my view. It keeps loading until gets a memory crash. – Joao Pauloself.view
withmapView_
- instead, addmapView_
as a subview toself.view
– Adam