1

App is experiencing following crash and unable to understand the cause behind of this crash. This crash report I got it from App Store. This is the crash report screenshot

-[viewcontroller .cxx_destruct] symbolicated crash report

It is mostly affecting on iOS 10.2. In this class I'm using Google Maps, Pageviewcontroller and Timer. So, anyone can tell me how to figure out it?

Antony Raphel
  • 2,036
  • 2
  • 25
  • 45
  • please you exceptional Break points – Ajjjjjjjj Apr 03 '17 at 06:08
  • This crash report I got it from App Store. While testing/debugging I'm not getting this issue/crash. – Antony Raphel Apr 03 '17 at 06:10
  • @AntonyRaphel Ask them to provide steps to reproduce as you are not able to, they will help, or they must have given steps to reproduce check their response carefully. – iphonic Apr 03 '17 at 06:38
  • I got this report by making archive and clicked on crashes segment button. Then I selected the version. @iphonic To whom I have to ask? Can you guide me? – Antony Raphel Apr 03 '17 at 06:40
  • @AntonyRaphel I thought you got this in iTunesConnect section by Apple, so I was telling you ask Apple for the steps. Though the crash looks like memory leak in your code. – iphonic Apr 03 '17 at 06:43
  • @iphonic, Under iTunesConnect also I got the crash count. Yeah, even I'm thinking same as ARC issue. But, difficult to find out where it is happening. – Antony Raphel Apr 03 '17 at 06:46

1 Answers1

1

This crash is happening due to fetching user current location from Google Maps by using addObserver forKeyPath:@"myLocation" options:NSKeyValueObservingOptionNew.

While dealloc Google Maps, that time you need to remove this Observer. Otherwise app will crash with following error

NSInternalInconsistencyException: An instance 0x1759f350 of class GMSMapView was deallocated while key value observers were still registered with it. Current observation info: ( Context: 0x0, Property: 0x177a4490> )

you need to addObserver before adding Google Maps to mapView like following:

// Listen to the myLocation property of GMSMapView.
[mapView_ addObserver:self
         forKeyPath:@"myLocation"
            options:NSKeyValueObservingOptionNew
            context:NULL];

self.view = mapView_;

// Ask for My Location data after the map has already been added to the UI.
dispatch_async(dispatch_get_main_queue(), ^{
   mapView_.myLocationEnabled = YES;
});

#pragma mark - KVO updates

- (void)observeValueForKeyPath:(NSString *)keyPath
                  ofObject:(id)object
                    change:(NSDictionary *)change
                   context:(void *)context {
if (!firstLocationUpdate_) {
// If the first location update has not yet been received, then jump to that
// location.
  firstLocationUpdate_ = YES;
  CLLocation *location = [change objectForKey:NSKeyValueChangeNewKey];
mapView_.camera = [GMSCameraPosition cameraWithTarget:location.coordinate
                                                 zoom:14];
 }
}

then add this code also for removing the observer

- (void)dealloc {
[mapView_ removeObserver:self
            forKeyPath:@"myLocation"
               context:NULL];
}

for more details: Google Maps iOS SDK, Getting Current Location of user

Community
  • 1
  • 1
Antony Raphel
  • 2,036
  • 2
  • 25
  • 45