The app am developing crashes on launch. The code runs perfectly on the simulator. However, when I run the .ipa archive through iTunes, the app crashes. As you can see from the error log below, NSObject call the doesNotRecognizeSelector:
method. The culprit as pointed to by the line number displayed in the error log at Line 202 is:
self.mapView.mapType = kGMSTypeNormal;
in the viewDidLoad:
method.
I commented this out but the error log simply caught the next line starting with:
self.mapView
Do note that self.mapView
is an outlet of a GMSMapView
configured through the storyboard.
The error log as follows:
Incident Identifier: 4F7341AD-7C0E-4383-8B40-AED516F165F0
CrashReporter Key: 6e031db1ca4c291576f3a897221102f0aef6019c
Hardware Model: iPhone5,2
Process: MyAppName [3224]
Path: /var/mobile/Applications/BFF8291E-CB8E-47F3-A43C-32F272C7DEA6/MyAppName.app/MyAppName
Identifier: com.vikrambahl.MyAppName
Version: 1.0 (1.0)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2014-07-08 15:33:28.745 +0800
OS Version: iOS 7.1.2 (11D257)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x2d876ec6 __exceptionPreprocess + 126
1 libobjc.A.dylib 0x38011ce2 objc_exception_throw + 34
2 CoreFoundation 0x2d87a7f2 -[NSObject(NSObject) doesNotRecognizeSelector:] + 198
3 CoreFoundation 0x2d8790f2 ___forwarding___ + 702
4 CoreFoundation 0x2d7c8054 _CF_forwarding_prep_0 + 20
5 MyAppName 0x000208bc -[MainViewController viewDidLoad] (MainViewController.m:202)
6 UIKit 0x300aca2e -[UIViewController loadViewIfRequired] + 514
7 UIKit 0x301572e8 -[UINavigationController _layoutViewController:] + 28
8 UIKit 0x301571fe -[UINavigationController _updateScrollViewFromViewController:toViewController:] + 226
9 UIKit 0x301567dc -[UINavigationController _startTransition:fromViewController:toViewController:] + 76
10 UIKit 0x30156504 -[UINavigationController _startDeferredTransitionIfNeeded:] + 568
11 UIKit 0x30156274 -[UINavigationController __viewWillLayoutSubviews] + 40
12 UIKit 0x3015620c -[UILayoutContainerView layoutSubviews] + 180
13 UIKit 0x300a82e0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 376
14 QuartzCore 0x2fd24316 -[CALayer layoutSublayers] + 138
15 QuartzCore 0x2fd1fb3a CA::Layer::layout_if_needed(CA::Transaction*) + 346
16 QuartzCore 0x2fd4eb48 -[CALayer layoutIfNeeded] + 136
17 UIKit 0x3012487a -[UIViewController window:setupWithInterfaceOrientation:] + 238
18 UIKit 0x30122e84 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 3508
19 UIKit 0x301220c2 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 42
20 UIKit 0x3012204a -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 90
21 UIKit 0x30121fe2 -[UIWindow _setRotatableViewOrientation:duration:force:] + 38
22 UIKit 0x3011a65c __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 104
23 UIKit 0x300ae672 -[UIWindow _updateToInterfaceOrientation:duration:force:] + 378
24 UIKit 0x30121d34 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 692
25 UIKit 0x30121804 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 156
26 UIKit 0x300b35f0 -[UIWindow addRootViewControllerViewIfPossible] + 456
27 UIKit 0x300b0db4 -[UIWindow _setHidden:forced:] + 300
28 UIKit 0x3011aa2c -[UIWindow makeKeyAndVisible] + 56
29 UIKit 0x301176c0 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1816
30 UIKit 0x30111ca4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 716
31 UIKit 0x300adc72 -[UIApplication handleEvent:withNewEvent:] + 3546
32 UIKit 0x300acdd4 -[UIApplication sendEvent:] + 68
33 UIKit 0x301113e0 _UIApplicationHandleEvent + 612
34 GraphicsServices 0x3271ab50 _PurpleEventCallback + 604
35 GraphicsServices 0x3271a73a PurpleEventCallback + 30
36 CoreFoundation 0x2d841802 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
37 CoreFoundation 0x2d84179e __CFRunLoopDoSource1 + 342
38 CoreFoundation 0x2d83ff6a __CFRunLoopRun + 1402
39 CoreFoundation 0x2d7aa724 CFRunLoopRunSpecific + 520
40 CoreFoundation 0x2d7aa506 CFRunLoopRunInMode + 102
41 UIKit 0x30110606 -[UIApplication _run] + 758
42 UIKit 0x3010b86c UIApplicationMain + 1132
43 MyAppName 0x00017a98 main (main.m:37)
44 libdyld.dylib 0x3850fab2 tlv_initializer + 2
My viewDidLoad method looks like this:
- (void)viewDidLoad
{
[super viewDidLoad];
// Ask for My Location data after the map has already been added to the UI.
dispatch_async(dispatch_get_main_queue(), ^{
self.mapView.myLocationEnabled = YES;
});
// Listen to the myLocation property of GMSMapView.
[self.mapView addObserver:self
forKeyPath:@"myLocation"
options:NSKeyValueObservingOptionNew
context:NULL];
self.mapView.mapType = kGMSTypeNormal;
self.mapView.accessibilityElementsHidden = NO;
self.mapView.settings.compassButton = YES;
self.mapView.settings.myLocationButton = YES;
self.mapView.delegate = self;
//Enter camera settings here
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:self.mapView.myLocation.coordinate.latitude longitude:self.mapView.myLocation.coordinate.longitude zoom:14];
self.mapView.camera = camera;
}
Could it be that you have -ObjC in your debug build but not in your release build?