Search code examples
iosobjective-cgoogle-mapsuiviewgmsmapview

Google Maps SDK crash on ItunesConnect test not Xcode


Google Maps SDK makes my app crash, I don't know what I'm doing wrong... I put my GMSMapView in a UIView in interface builder.

Here is my code : Contact.h :

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#import <ParseFacebookUtils/PFFacebookUtils.h>
#import <GoogleMaps/GoogleMaps.h>

@interface Contact : UIViewController <MFMailComposeViewControllerDelegate>

- (IBAction)openMail:(id)sender;
@property (weak, nonatomic) IBOutlet GMSMapView *mapView;
@property (weak, nonatomic) IBOutlet UILabel *contactLabel;


@end

Contact.m :

#import "Contact.h"


@interface Contact ()

@end

@implementation Contact

- (void)viewDidLoad {
    [super viewDidLoad];

#pragma mark - Google Map API
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude: 54.481151
                                                            longitude: -8.272278 zoom: 15];
    [self.mapView animateToCameraPosition:camera];
    GMSMarker *marker = [ [GMSMarker alloc] init];
    marker.position = camera.target;
    marker.title = @"Bundoran Surf Co";
    marker.snippet = @"Main Street";
    marker.map = self.mapView;
}

I symbolicated the app crash from Apple, and that crash on this line when the view appears :

[self.mapView animateToCameraPosition:camera];

Here is my config enter image description here

enter image description here


Solution

  • You are missing the "-ObjC" flag from your Release build linker flags so what gets submitted to the App Store does not quite reflect what you're debugging.

    If you edit the Run scheme, you should be able to select Release Build Configuration and reproduce this

    From here: GoogleMaps basic iOS demo app crash - unrecognized selector sent to instance