2

I have integrated with Socket Mobile scanners using the ScanApiSDK (v 10.2.227). We received a crash log on -[AccessoryMonitor CheckForChanges:] which seems to be part of the SDK.

Has anyone experienced this before? What would be the best way to find the cause of the issue?

Appreciate any help. Crash log is below.

*** -[__NSArrayM getObjects:range:]: range {0, 1} extends beyond bounds for empty array

#7. Crashed: com.twitter.crashlytics.ios.exception
0  MyFirstApp                     0x10076389c CLSProcessRecordAllThreads + 4302256284
1  MyFirstApp                     0x10076389c CLSProcessRecordAllThreads + 4302256284
2  MyFirstApp                     0x100763d4c CLSProcessRecordAllThreads + 4302257484
3  MyFirstApp                     0x10074e78c CLSHandler + 4302169996
4  MyFirstApp                     0x100761aa4 __CLSExceptionRecord_block_invoke + 4302248612
5  libdispatch.dylib              0x1811d947c _dispatch_client_callout + 16
6  libdispatch.dylib              0x1811e4728 _dispatch_barrier_sync_f_invoke + 100
7  MyFirstApp                     0x10076163c CLSExceptionRecord + 4302247484
8  MyFirstApp                     0x100761454 CLSExceptionRecordNSException + 4302246996
9  MyFirstApp                     0x1007610b4 CLSTerminateHandler() + 4302246068
10 libc++abi.dylib                0x180de6f44 std::__terminate(void (*)()) + 16
11 libc++abi.dylib                0x180de685c __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*) + 134
12 libobjc.A.dylib                0x180df4094 _objc_exception_destructor(void*) + 330
13 CoreFoundation                 0x181672ff8 -[NSMutableArray sortUsingSelector:] + 634
14 CoreFoundation                 0x181672b10 -[NSArray initWithArray:range:copyItems:] + 248
15 CoreFoundation                 0x181672a04 +[NSArray arrayWithArray:] + 80
16 MyFirstApp                     0x1004f59d8 -[AccessoryMonitor CheckForChanges:] (AccessoryMonitor.m:204)
17 MyFirstApp                     0x1004f5be0 SktAccessoryEnumerator::Wait(unsigned long, TSktHardware**, CSktTransport**) (SktAccessoryEnumerator.mm:86)
18 MyFirstApp                     0x1004e6130 SktScanAPIListenerThread(void*) (SktListener.mm:207)
19 libsystem_pthread.dylib        0x1813f3b28 _pthread_body + 156
20 libsystem_pthread.dylib        0x1813f3a8c _pthread_body + 154
21 libsystem_pthread.dylib        0x1813f1028 thread_start + 4

--

Fatal Exception: NSRangeException
0  CoreFoundation                 0x18178edb0 __exceptionPreprocess
1  libobjc.A.dylib                0x180df3f80 objc_exception_throw
2  CoreFoundation                 0x181672ff8 -[NSMutableArray sortUsingSelector:]
3  CoreFoundation                 0x181672b10 -[NSArray initWithArray:range:copyItems:]
4  CoreFoundation                 0x181672a04 +[NSArray arrayWithArray:]
5  MyFirstApp                     0x1004f59d8 -[AccessoryMonitor CheckForChanges:] (AccessoryMonitor.m:204)
6  MyFirstApp                     0x1004f5be0 SktAccessoryEnumerator::Wait(unsigned long, TSktHardware**, CSktTransport**) (SktAccessoryEnumerator.mm:86)
7  MyFirstApp                     0x1004e6130 SktScanAPIListenerThread(void*) (SktListener.mm:207)
8  libsystem_pthread.dylib        0x1813f3b28 _pthread_body
9  libsystem_pthread.dylib        0x1813f3a8c _pthread_body
10 libsystem_pthread.dylib        0x1813f1028 thread_start
Andy
  • 21
  • 1
  • How many times have you seen this crash? Based on the stacktrace my best guess is this is that the array passed to `initWithArray` was modified - i.e. the sole element was removed - in the exact moment that the array was being copied – Enrico Aug 30 '16 at 13:22
  • I've seen a crash related to AccessoryMonitor at least twice though I don't remember if they were the same. So would it be caused by disconnecting the scanner at a particular time? How does my app affect the array? – Andy Aug 31 '16 at 23:15
  • Yes, it would be caused by disconnecting the scanner in the split second between the array being sized and the last element being copied over. It's such a narrow window I'd be shocked if you saw it more than once. I'll keep investigating and let you know if I come up with anything – Enrico Sep 02 '16 at 15:01
  • I found the same issue with SDK version 10.3.90 . – vampirewalk May 09 '18 at 04:39
  • I am also struggling with same issue. – Jignesh Kanani Dec 30 '20 at 04:37

0 Answers0