Skip to content

Terminating app due to uncaught exception 'NSRangeException' #42

@jmrborges05

Description

@jmrborges05

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions