TSClusterMapView icon indicating copy to clipboard operation
TSClusterMapView copied to clipboard

Terminating app due to uncaught exception 'NSRangeException'

Open jmrborges05 opened this issue 9 years ago • 1 comments

When i open the map view the app crash. i try to check where is the crash, the map view crash before viewDidLoad. The trace of the error is this: *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFArray objectAtIndex:]: index (0) beyond bounds (0)'

i check in crashlytics to view where is the error and the report is in this file: TSClusterMapView.m line 36 -[TSClusterMapView initWithCoder:]

There is the code where i put the annotations:

 self.annotations = [PoiAnnotation]()
          for i in 0 ..< self.pois.count {
               if let poi = self.pois.objectAtIndex(i) as? Pois {
                    let marker = Marker.init(
                         title: poi.title, subtitle: String(poi.poi_type_id), latitude: (poi.lat as NSString).doubleValue, longitude: (poi.lng as NSString).doubleValue, poi:poi
                    )
                    annotations.append(marker.annotation)
               }
          }
          if let annotationFilter = self.defaults.objectForKey("annotationFilter") as? [Int] {
               print(annotationFilter)
               self.filterCategoriesbyExistentFilter(annotationFilter)
          }
          self.mapView.addClusteredAnnotations(annotations)

This is only occurred in one device Iphone 5s. I'm using version 2.10 of the pod.

jmrborges05 avatar Jul 28 '16 17:07 jmrborges05

Do you have a full stack trace?

Does this crash happen when you add annotations or during the initialization? If it is during initialization you might have an issue outside the scope of this framework.

AdamShare avatar Aug 04 '16 21:08 AdamShare