NSRangeException after app update and ios update to ios13

I am receiving NSRangeException errors in a seemingly random way since it does not always happen when updating my app (developed with xcode11 and ios deployment target set to iOS 9.0) and agree that the operating system has also been updated to ios13. Checking the xcode logs I see the following:


Fatal Exception: NSRangeException
0  CoreFoundation                 0x1aab0c98c __exceptionPreprocess
1  libobjc.A.dylib                0x1aa8350a4 objc_exception_throw
2  CoreFoundation                 0x1aab623f8 -[__NSCFString characterAtIndex:].cold.1
3  CoreFoundation                 0x1aaa0aa38 -[CFPrefsSearchListSource _getPendingNotifications]
4  CoreFoundation                 0x1aab46f1c -[NSOrderedSet countByEnumeratingWithState:objects:count:]
5  MapKit                         0x1b82c6c6c -[MKAnnotationContainerView(VKSpaceReserving) annotationsInMapRect:]
6  VectorKit                      0x1b8cdab88 md::LabelCustomFeatureProvider::populateLabelFeaturesInTile(std::__1::vector<std::__1::shared_ptr, geo::StdAllocator<std::__1::shared_ptr, mdm::Allocator> >&, md::LabelMapTile*)
7  VectorKit                      0x1b8cd8660 md::LabelCustomFeatureSupport::populateLabelFeaturesInTile(std::__1::vector<std::__1::shared_ptr, geo::StdAllocator<std::__1::shared_ptr, mdm::Allocator> >&, md::LabelMapTile*)
8  VectorKit                      0x1b8de43b0 std::__1::__function::__func<md::labelmaptile::setneedscustomfeatureupdate()::$_5, std::__1::allocator<md::labelmaptile::setneedscustomfeatureupdate()::$_5="">, void (md::LabelManager*)>::operator()(md::LabelManager*&&)
9  VectorKit                      0x1b8de2eb0 md::LabelMapTile::flushQueuedSettings(md::LabelManager*)
10 VectorKit                      0x1b8d4b5f8 md::LabelPool::updateMapTilesUsed(std::__1::unordered_set<std::__1::shared_ptr, std::__1::hash<std::__1::shared_ptr >, std::__1::equal_to<std::__1::shared_ptr >, geo::StdAllocator<std::__1::shared_ptr, mdm::Allocator> > const&, bool)
11 VectorKit                      0x1b8c15374 md::StandardLabeler::synchronizedUpdate(md::LayoutContext const&, std::__1::unordered_set<std::__1::shared_ptr, std::__1::hash<std::__1::shared_ptr >, std::__1::equal_to<std::__1::shared_ptr >, geo::StdAllocator<std::__1::shared_ptr, mdm::Allocator> > const&, bool)
12 VectorKit                      0x1b8a08884 md::MapStandardLabeler::synchronizedUpdate(md::LayoutContext const&, std::__1::unordered_set<std::__1::shared_ptr, std::__1::hash<std::__1::shared_ptr >, std::__1::equal_to<std::__1::shared_ptr >, geo::StdAllocator<std::__1::shared_ptr, mdm::Allocator> > const&, bool)
13 VectorKit                      0x1b8d52af8 md::CompositeLabeler::synchronizedUpdate(md::LayoutContext const&, std::__1::unordered_set<std::__1::shared_ptr, std::__1::hash<std::__1::shared_ptr >, std::__1::equal_to<std::__1::shared_ptr >, geo::StdAllocator<std::__1::shared_ptr, mdm::Allocator> > const&, bool)
14 VectorKit                      0x1b8be3d84 md::LabelManager::layout(md::LayoutContext const&, md::CartographicRenderer const*, std::__1::unordered_set<std::__1::shared_ptr, std::__1::hash<std::__1::shared_ptr >, std::__1::equal_to<std::__1::shared_ptr >, geo::StdAllocator<std::__1::shared_ptr, mdm::Allocator> > const&, md::PassList&)
15 VectorKit                      0x1b89e5ea0 md::LabelRenderLayer::layout(md::LayoutContext const&)
16 VectorKit                      0x1b8c0c6f0 std::__1::__function::__func<md::cartographicrenderlayer::frame(md::layoutcontext const&)::$_0,="" std::__1::allocator<md::cartographicrenderlayer::frame(md::layoutcontext="" const&)::$_0="">, void ()>::operator()()
17 VectorKit                      0x1b8c0c5b0 invocation function for block in geo::TaskQueue::queueAsyncTask(std::__1::shared_ptr, NSObject<os_dispatch_group>*)
18 libdispatch.dylib              0x1aa7d9610 _dispatch_call_block_and_release
19 libdispatch.dylib              0x1aa7da184 _dispatch_client_callout
20 libdispatch.dylib              0x1aa7b773c _dispatch_lane_serial_drain$VARIANT$armv81
21 libdispatch.dylib              0x1aa7b8188 _dispatch_lane_invoke$VARIANT$armv81
22 libdispatch.dylib              0x1aa7b92a8 _dispatch_workloop_invoke$VARIANT$armv81
23 libdispatch.dylib              0x1aa7c143c _dispatch_workloop_worker_thread
24 libsystem_pthread.dylib        0x1aa829fa4 _pthread_wqthread
25 libsystem_pthread.dylib        0x1aa82cae0 start_wqthread

At the devide logs, just before the crash i am apparently getting location updates... found this device logs just before the crash


por omisión 11:54:12.178112 +0200 backboardd Lcurrent=113.5965 Lr=1.1476 DR=98.9852 factor=0.0745
por omisión 11:54:12.194760 +0200 backboardd Lcurrent=113.5965 Lr=1.1476 DR=98.9892 factor=0.0745
por omisión 11:54:12.200248 +0200 nsurlsessiond Triggering periodic update to powerlog for client 
por omisión 11:54:12.211528 +0200 backboardd Lcurrent=113.5965 Lr=1.1475 DR=98.9932 factor=0.0745
por omisión 11:54:12.228108 +0200 backboardd Lcurrent=113.5965 Lr=1.1475 DR=98.9971 factor=0.0745
por omisión 11:54:12.244770 +0200 backboardd Lcurrent=113.5965 Lr=1.1474 DR=99.0011 factor=0.0744
por omisión 11:54:12.252963 +0200 symptomsd defusing ticker tickerFatal having seen progress by flow for com.myapp, rxbytes 5489 duration 62.153 seconds started at time: Mon Oct 14 11:53:10 2019
por omisión 11:54:12.261382 +0200 backboardd Lcurrent=113.5965 Lr=1.1474 DR=99.0051 factor=0.0744
por omisión 11:54:12.270914 +0200 myApp *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** _oset_getObjectsRange: range {64, 2} extends beyond bounds [0 .. 64]'
*** First throw call stack:
(0x1be6bc98c 0x1be3e50a4 0x1be7123f8 0x1be5baa38 0x1be6f6f1c 0x1cbe76d54 0x1cc88ab88 0x1cc888660 0x1cc9943b0 0x1cc992eb0 0x1cc8fb5f8 0x1cc7c5374 0x1cc5b8884 0x1cc902af8 0x1cc793d84 0x1cc595ea0 0x1cc7bc6f0 0x1cc7bc5b0 0x1be389610 0x1be38a184 0x1be36773c 0x1be368188 0x1be3692a8 0x1be37143c 0x1be3d9fa4 0x1be3dcae0)


Any help finding the problem would be greatly appreciated.

Replies

To help you it would help seeing the code where the error occurs, in its context.

Do you have an Apple crash report for the problem? If so, please post it here. Use the

<>
button to format it as code.

For more info on getting crash reports, see Technote 2151 Understanding and Analyzing iOS Application Crash Reports.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
I am facing similar kind of crash when using location services.... with iOS 13. Any update on why this crash is happening.