Thread 12 Crashed:
0 libsystem_kernel.dylib 0x3076da1c __pthread_kill + 8
1 libsystem_c.dylib 0x35c8a3b4 pthread_kill + 52
2 libsystem_c.dylib 0x35c82bf8 abort + 72
3 libstdc++.6.dylib 0x33f61a64 __gnu_cxx::__verbose_terminate_handler() + 376
4 libobjc.A.dylib 0x360f506c _objc_terminate + 104
5 libstdc++.6.dylib 0x33f5fe36 __cxxabiv1::__terminate(void (*)()) + 46
6 libstdc++.6.dylib 0x33f5fe8a std::terminate() + 10
7 libstdc++.6.dylib 0x33f5ff5a __cxa_throw + 78
8 libobjc.A.dylib 0x360f3c84 objc_exception_throw + 64
9 Foundation 0x31af8dea _NSOutOfMemoryErrorHandler + 38
10 CoreFoundation 0x31e91496 __CFStringHandleOutOfMemory + 22
11 CoreFoundation 0x31e951ea __CFStringChangeSizeMultiple + 506
12 CoreFoundation 0x31e982c0 __CFStringCheckAndReplace + 148
13 Foundation 0x31a81228 -[NSCFString appendString:] + 28
14 MyApp 0x00016a86 -[XMLParser parser:foundCharacters:] (XMLParser.m:109)
Crashed with SIGABRT on device.
XMLParser code snippet :
- (void)parser:(XMLParser *)parser foundCharacters:(NSString *)string
{
if(!currentString)
{
currentString = [[NSMutableString alloc] init];
}
[currentString appendString:string]; // Line 109 that crashed
}
Why does it crash there is it appending nil string ? or accessing protected memory
The _NSOutOfMemoryErrorHandler makes it rather clear - you're running out of memory. Check for parts that are too memory-intensive for the device using Instruments and memory leaks etc.
Related
I'm getting a unconditionallyBridgeFromObjectiveC crash in an Apple Watch app out in the wild. I'm not able to replicate it locally, and haven't ever encountered it on a test device through regular use. Here's the info about the exception:
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000000224c58b0
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [653]
The crash reports show it's happening on the second line of this code:
let name: String
name = WKInterfaceDevice.current().name
(I have these on separate lines for better readability in my code)
I'm not very family with Objective-C or how things can fail related to Objective-C values, but from what I've found around the Internet, here's my guess:
Even though the API says that WKInterfaceDevice.current().name is a String instead of String?, name is somehow actually a nil value in some cases.
As a possible solution, I'm thinking that instead of name: String I should use name: String? and then make sure it's non-nil later. Does this make sense? Would that help with the issue, or would it be possible that it still crashes from trying to store WKInterfaceDevice.current().name in a constant of type String?? Is there some other kind of safety check I should be doing on WKInterfaceDevice.current().name first?
This crash is not happening much (on at least 7 devices out of ~5000 in about 5 days) but it's the most frequent crash in the newest version of my app, so I'm trying to use it as a learning opportunity to make my app more robust. I guess maybe it could be an issue in WatchKit rather than a problem with my code? Or something that could only be checked and solved with Objective-C?
Stack Trace:
Hardware Model: Watch5,2
Version: 1 (2020.29)
AppVariant: 1:Watch5,2:6
Code Type: ARM (Native)
Role: Foreground
Parent Process: launchd [1]
Date/Time: 2020-05-28 14:32:42.6998 +0900
Launch Time: 2020-05-28 14:32:07.0000 +0900
OS Version: Watch OS 6.2.5 (17T608)
Release Type: User
Baseband Version: n/a
Report Version: 104
Exception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000000224c58b0
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [653]
Triggered by Thread: 5
Thread 0 name:
Thread 0:
0 libsystem_kernel.dylib 0x21fdb134 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x21fda604 mach_msg + 72 (mach_msg.c:103)
2 libdispatch.dylib 0x21e5a49c _dispatch_mach_send_and_wait_for_reply + 580 (mach.c:830)
3 libdispatch.dylib 0x21e5a858 dispatch_mach_send_with_result_and_wait_for_reply + 52 (mach.c:2006)
4 libxpc.dylib 0x220bd150 xpc_connection_send_message_with_reply_sync + 228 (connection.c:829)
5 CoreFoundation 0x2239cfec __99-[CFPrefsPlistSource sendFullyPreparedMessage:toConnection:settingValues:forKeys:count:retryCount:]_block_invoke + 56 (CFPrefsPlistSource.m:933)
6 CoreFoundation 0x22353cb4 -[_CFXPreferences withConnectionForRole:performBlock:] + 48 (CFXPreferences.m:1330)
7 CoreFoundation 0x2239cf88 -[CFPrefsPlistSource sendFullyPreparedMessage:toConnection:settingValues:forKeys:count:retryCount:] + 188 (CFPrefsPlistSource.m:962)
8 CoreFoundation 0x2239d2c4 -[CFPrefsPlistSource sendMessageSettingValues:forKeys:count:] + 304 (CFPrefsPlistSource.m:994)
9 CoreFoundation 0x2239c0f4 -[CFPrefsPlistSource alreadylocked_setPrecopiedValues:forKeys:count:from:] + 948 (CFPrefsPlistSource.m:397)
10 CoreFoundation 0x2249ac9c -[CFPrefsSource setValues:forKeys:count:copyValues:removeValuesForKeys:count:from:] + 392 (CFPrefsSource.m:771)
11 CoreFoundation 0x2249affc -[CFPrefsSource setValues:forKeys:count:copyValues:from:] + 36 (CFPrefsSource.m:793)
12 CoreFoundation 0x223d74e4 -[CFPrefsSearchListSource alreadylocked_setPrecopiedValues:forKeys:count:from:] + 968 (CFPrefsSearchListSource.m:738)
13 CoreFoundation 0x2249ac9c -[CFPrefsSource setValues:forKeys:count:copyValues:removeValuesForKeys:count:from:] + 392 (CFPrefsSource.m:771)
14 CoreFoundation 0x2249affc -[CFPrefsSource setValues:forKeys:count:copyValues:from:] + 36 (CFPrefsSource.m:793)
15 CoreFoundation 0x2234fc04 -[CFPrefsSource setValue:forKey:from:] + 64 (CFPrefsSource.m:799)
16 CoreFoundation 0x224a3008 __76-[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:]_block_invoke + 64 (CFXPreferences.m:795)
17 CoreFoundation 0x223d9540 __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 372 (CFPrefsSearchListSource.m:1719)
18 CoreFoundation 0x2234c6bc -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 340 (CFPrefsSearchListSource.m:68)
19 CoreFoundation 0x2234f674 -[_CFXPreferences setValue:forKey:appIdentifier:container:configurationURL:] + 108 (CFXPreferences.m:791)
20 CoreFoundation 0x224a619c _CFPreferencesSetAppValueWithContainerAndConfiguration + 132 (CFXPreferences.m:1853)
21 Foundation 0x22e55a4c -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 64 (NSUserDefaults.m:226)
22 My App Name 0x04a55320 specialized static NSUserDefaults.lastSentToPhone.setter + 272 (UserDefaults.swift:423)
23 My App Name 0x04a500ac WatchConnectivityManager.sendBatteryLevel() + 2692 (<compiler-generated>:0)
24 My App Name 0x04a55714 #objc ExtensionDelegate.applicationWillEnterForeground() + 188 (ExtensionDelegate.swift:32)
25 WatchKit 0x34d21654 __80-[SPRemoteInterface applicationWillEnterForeground:withVisibleViewControllerID:]_block_invoke_2 + 128 (SPRemoteInterface.m:3668)
26 WatchKit 0x34d40910 -[SPRemoteInterface performAfterApplicationDidFinishLaunching:] + 56 (SPRemoteInterface.m:3713)
27 WatchKit 0x34d215c8 __80-[SPRemoteInterface applicationWillEnterForeground:withVisibleViewControllerID:]_block_invoke + 80 (SPRemoteInterface.m:3666)
28 WatchKit 0x34d3ef08 spUtils_dispatchAsyncToMainThread + 40 (SPUtils.m:347)
29 WatchKit 0x34d21444 -[SPRemoteInterface applicationWillEnterForeground:withVisibleViewControllerID:] + 212 (SPRemoteInterface.m:3665)
30 WatchKit 0x34d2135c -[SPRemoteInterface appWillEnterForeground:withVisibleViewControllerID:] + 60 (SPRemoteInterface.m:4535)
31 WatchKit 0x34d21280 __75-[SPExtensionConnection appWillEnterForegroundWithVisibleViewControllerID:]_block_invoke + 320 (SPExtensionConnection.m:1669)
32 WatchKit 0x34d3d64c -[SPExtensionConnection performOnSendQueue:syncIfUnsuspended:] + 564 (SPExtensionConnection.m:0)
33 WatchKit 0x34d2111c -[SPExtensionConnection appWillEnterForegroundWithVisibleViewControllerID:] + 112 (SPExtensionConnection.m:1667)
34 WatchKit 0x34d21010 -[SPApplicationDelegate applicationWillEnterForeground:] + 264 (SPApplicationDelegate.m:670)
35 UIKitCore 0x3f3a7ca4 -[UIApplication _sendWillEnterForegroundCallbacks] + 164 (UIApplication.m:10680)
36 UIKitCore 0x3ec6c630 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_2 + 1748 (_UISceneLifecycleMultiplexer.m:572)
37 UIKitCore 0x3f069a5c _UIScenePerformActionsWithLifecycleActionMask + 104 (_UISceneLifecycleState.m:109)
38 UIKitCore 0x3ec6beb8 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 208 (_UISceneLifecycleMultiplexer.m:501)
39 UIKitCore 0x3ec6b8d0 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 292 (_UISceneLifecycleMultiplexer.m:450)
40 UIKitCore 0x3ec6bcc4 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 768 (_UISceneLifecycleMultiplexer.m:500)
41 UIKitCore 0x3ec6b564 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 336 (_UISceneLifecycleMultiplexer.m:406)
42 UIKitCore 0x3ec6fb50 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... + 188 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:102)
43 UIKitCore 0x3efa7548 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 804 (BSAnimationSettings+UIKit.m:50)
44 UIKitCore 0x3f0827dc _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 244 (_UISceneSettingsDiffAction.m:43)
45 UIKitCore 0x3ec6f920 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block... + 136 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:87)
46 UIKitCore 0x3f0826d8 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 100 (_UISceneSettingsDiffAction.m:35)
47 UIKitCore 0x3ec6f78c -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 376 (_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction.m:85)
48 UIKitCore 0x3eaf2b78 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 640 (UIScene.m:1340)
49 UIKitCore 0x3eaf1720 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 236 (UIScene.m:1073)
50 UIKitCore 0x3eaf28ac -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 220 (UIScene.m:1317)
51 UIKitCore 0x3efc7c8c -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 464 (UIApplicationSceneClientAgent.m:80)
52 PepperUICore 0x2ebc2d94 -[PUICApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 804 (PUICApplicationSceneClientAgent.m:156)
53 CarouselUIServices 0x32abcbec -[CUISWatchKitApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 276 (CUISWatchKitApplicationSceneClientAgent.m:80)
54 FrontBoardServices 0x25ea1660 -[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:] + 528 (FBSSceneImpl.m:551)
55 FrontBoardServices 0x25ec5914 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke_2 + 120 (FBSWorkspaceScenesClient.m:356)
56 FrontBoardServices 0x25eab12c -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232 (FBSWorkspace.m:357)
57 FrontBoardServices 0x25ec5848 __88-[FBSWorkspaceScenesClient sceneID:updateWithSettingsDiff:transitionContext:completion:]_block_invoke + 184 (FBSWorkspaceScenesClient.m:355)
58 libdispatch.dylib 0x21e44fc0 _dispatch_client_callout + 16 (object.m:495)
59 libdispatch.dylib 0x21e47cac _dispatch_block_invoke_direct + 248 (queue.c:466)
60 FrontBoardServices 0x25ee9b44 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 40 (FBSSerialQueue.m:173)
61 FrontBoardServices 0x25ee9810 -[FBSSerialQueue _queue_performNextIfPossible] + 412 (FBSSerialQueue.m:216)
62 FrontBoardServices 0x25ee9d94 -[FBSSerialQueue _performNextFromRunLoopSource] + 28 (FBSSerialQueue.m:247)
63 CoreFoundation 0x223ee2f8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24 (CFRunLoop.c:1922)
64 CoreFoundation 0x223ee250 __CFRunLoopDoSource0 + 80 (CFRunLoop.c:1956)
65 CoreFoundation 0x223ed9f0 __CFRunLoopDoSources0 + 184 (CFRunLoop.c:1992)
66 CoreFoundation 0x223e8adc __CFRunLoopRun + 772 (CFRunLoop.c:2882)
67 CoreFoundation 0x223e84d0 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3192)
68 GraphicsServices 0x25984358 GSEventRunModal + 160 (GSEvent.c:2246)
69 UIKitCore 0x3f392fac UIApplicationMain + 1756 (UIApplication.m:4820)
70 libxpc.dylib 0x220d9bdc _xpc_objc_main.cold.3 + 208
71 libxpc.dylib 0x220c5ccc _xpc_objc_main + 212 (main.m:0)
72 libxpc.dylib 0x220c82b0 xpc_main + 152 (init.c:1384)
73 Foundation 0x22e51738 -[NSXPCListener resume] + 160 (NSXPCListener.m:276)
74 PlugInKit 0x2bdb40a8 -[PKService run] + 396 (PKService.m:165)
75 WatchKit 0x34d39e94 WKExtensionMain + 60 (main.m:19)
76 libdyld.dylib 0x21e80f48 start + 4
Thread 1:
0 libsystem_pthread.dylib 0x22081800 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x22081800 start_wqthread + 0
Thread 3 name:
Thread 3:
0 libsystem_kernel.dylib 0x21fdb134 mach_msg_trap + 8
1 libsystem_kernel.dylib 0x21fda604 mach_msg + 72 (mach_msg.c:103)
2 CoreFoundation 0x223edb5c __CFRunLoopServiceMachPort + 148 (CFRunLoop.c:2575)
3 CoreFoundation 0x223e8c40 __CFRunLoopRun + 1128 (CFRunLoop.c:2931)
4 CoreFoundation 0x223e84d0 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3192)
5 Foundation 0x22e1638c -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 228 (NSRunLoop.m:374)
6 Foundation 0x22e1626c -[NSRunLoop(NSRunLoop) runUntilDate:] + 88 (NSRunLoop.m:421)
7 UIKitCore 0x3f4235f8 -[UIEventFetcher threadMain] + 152 (UIEventFetcher.m:733)
8 Foundation 0x22f42404 __NSThread__start__ + 844 (NSThread.m:724)
9 libsystem_pthread.dylib 0x22079984 _pthread_start + 156 (pthread.c:896)
10 libsystem_pthread.dylib 0x22081814 thread_start + 8
Thread 4 name:
Thread 4:
0 libobjc.A.dylib 0x21d8407c getMethodNoSuper_nolock(objc_class*, objc_selector*) + 168 (objc-runtime-new.mm:5813)
1 libobjc.A.dylib 0x21d8e164 lookUpImpOrForward + 348 (objc-runtime-new.mm:6221)
2 libobjc.A.dylib 0x21d7ad5c _objc_msgSend_uncached + 60
3 libobjc.A.dylib 0x21d7a588 CALLING_SOME_+initialize_METHOD + 20 (objc-initialize.mm:384)
4 libobjc.A.dylib 0x21d80140 initializeNonMetaClass + 548 (objc-initialize.mm:554)
5 libobjc.A.dylib 0x21d814d8 initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt<false>&, bool) + 272 (objc-runtime-new.mm:2183)
6 libobjc.A.dylib 0x21d8e2c8 lookUpImpOrForward + 704 (objc-runtime-new.mm:2199)
7 libobjc.A.dylib 0x21d7ad5c _objc_msgSend_uncached + 60
8 WatchConnectivity 0x3616795c -[WCQueueManager onqueue_sendMessage:completionHandler:] + 64 (WCQueueManager.m:100)
9 libdispatch.dylib 0x21e43c1c _dispatch_call_block_and_release + 24 (init.c:1408)
10 libdispatch.dylib 0x21e44fc0 _dispatch_client_callout + 16 (object.m:495)
11 libdispatch.dylib 0x21e4b128 _dispatch_lane_serial_drain + 676 (inline_internal.h:2484)
12 libdispatch.dylib 0x21e4bb08 _dispatch_lane_invoke + 404 (queue.c:3863)
13 libdispatch.dylib 0x21e5501c _dispatch_workloop_worker_thread + 584 (queue.c:6445)
14 libsystem_pthread.dylib 0x2207b704 _pthread_wqthread + 276 (pthread.c:2351)
15 libsystem_pthread.dylib 0x22081808 start_wqthread + 8
Thread 5 name:
Thread 5 Crashed:
0 CoreFoundation 0x224c58b0 _CFRelease.cold.2 + 16
1 CoreFoundation 0x223efda4 _CFRelease + 1440 (CFRuntime.c:2041)
2 libswiftCore.dylib 0x48565aa8 String.init(_cocoaString:) + 44 (<compiler-generated>:0)
3 libswiftFoundation.dylib 0x48820d94 static String._unconditionallyBridgeFromObjectiveC(_:) + 36 (String.swift:25)
4 My App Name 0x04a503f0 WatchConnectivityManager.getCurrentWatchInfo() + 424 (WatchConnectivityManager.swift:219)
5 My App Name 0x04a4f798 WatchConnectivityManager.sendWatchInfo() + 368 (WatchConnectivityManager.swift:149)
6 My App Name 0x04a508cc #objc WatchConnectivityManager.session(_:activationDidCompleteWith:error:) + 72 (WatchConnectivityManager.swift:252)
7 WatchConnectivity 0x36156f28 __57-[WCSession onqueue_completeSwitchTask:withSessionState:]_block_invoke_2 + 380 (WCSession.m:1509)
8 Foundation 0x22f1eb4c __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16 (NSOperation.m:1541)
9 Foundation 0x22e2ca00 -[NSBlockOperation main] + 84 (NSOperation.m:1560)
10 Foundation 0x22f20d80 __NSOPERATION_IS_INVOKING_MAIN__ + 20 (NSOperation.m:2184)
11 Foundation 0x22e2c6ec -[NSOperation start] + 752 (NSOperation.m:2201)
12 Foundation 0x22f21750 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 20 (NSOperation.m:2215)
13 Foundation 0x22f21230 __NSOQSchedule_f + 180 (NSOperation.m:2226)
14 libdispatch.dylib 0x21e43c1c _dispatch_call_block_and_release + 24 (init.c:1408)
15 libdispatch.dylib 0x21e44fc0 _dispatch_client_callout + 16 (object.m:495)
16 libdispatch.dylib 0x21e47700 _dispatch_continuation_pop + 496 (inline_internal.h:2484)
17 libdispatch.dylib 0x21e46e18 _dispatch_async_redirect_invoke + 588 (queue.c:803)
18 libdispatch.dylib 0x21e53cfc _dispatch_root_queue_drain + 356 (inline_internal.h:2525)
19 libdispatch.dylib 0x21e54494 _dispatch_worker_thread2 + 116 (queue.c:6628)
20 libsystem_pthread.dylib 0x2207b6c8 _pthread_wqthread + 216 (pthread.c:2364)
21 libsystem_pthread.dylib 0x22081808 start_wqthread + 8
Thread 6:
0 libsystem_pthread.dylib 0x22081800 start_wqthread + 0
Thread 7:
0 libsystem_pthread.dylib 0x22081800 start_wqthread + 0
Thread 5 crashed with ARM Thread State (64-bit):
x0: 0x0000000014ee1b10 x1: 0x0000000048c0cc97 x2: 0x0000000000005002 x3: 0x0000000000000000
x4: 0x0000000014ee1af0 x5: 0x0000000000000002 x6: 0x0000000000000000 x7: 0x0000000000000000
x8: 0x000000004fb0e000 x9: 0x0000000022533950 x10: 0x00000000153c2e00 x11: 0x000000000000003f
x12: 0x00000000153c2eb8 x13: 0x00000000001c0369 x14: 0x0000000000000000 x15: 0x000000005cd5d1ff
x16: 0x0000000050b251d8 x17: 0x000000002235c024 x18: 0x0000000000000000 x19: 0x0000000014ee1b10
x20: 0x0000000004600790 x21: 0x0000000014ee1b10 x22: 0x0000000000005002 x23: 0x0000000014d8e900
x24: 0x0000000000000001 x25: 0x0000000004a65000 x26: 0x000000000000c000 x27: 0x0000000004a65d60
x28: 0x00000000c0004002 fp: 0x00000000192ee8b0 lr: 0x00000000223efda4
sp: 0x00000000192ee840 pc: 0x00000000224c58b0 cpsr: 0x60000000
esr: 0xf2000001 Address size fault
WatchConnectivityManager class:
class WatchConnectivityManager {
static let shared = WatchConnectivityManager()
let session = WCSession.default
func sendWatchInfo() {
if session.activationState == .activated {
let name = getCurrentWatchInfo()
let message: [String : Any] = ["appleWatchName" : name]
if session.isReachable {
session.sendMessage(message,
replyHandler: nil,
errorHandler: nil)
}
do {
try session.updateApplicationContext(message)
} catch(let error) {
fatalError(error.localizedDescription)
}
}
}
private func getCurrentWatchInfo() -> String {
let name: String
name = WKInterfaceDevice.current().name
return name
}
}
Even though the API says that WKInterfaceDevice.current().name is a String instead of String?, name is somehow actually a nil value in some cases.
It can't be nil. name is a property declared as:
var name: String { get }
It can be an empty string, but not nil (Swift context). And the Objective-C:
#property(nonatomic, readonly, copy) NSString *name;
It's encapsulated with the NS_ASSUME_NONNULL_BEGIN & NS_ASSUME_NONNULL_END which effectively means:
#property(nonatomic, readonly, copy) NSString * _Nonnull safeName;
Read Nullability and Objective-C to see how it affects Objective-C -> Swift.
Actually it can be nil in the Objective-C context, but it violates the _Nonnull contract then.
As a possible solution, I'm thinking that instead of name: String I should use name: String?.
I don't think it's going to help even if you can do this. Imagine you have the following method1:
- (NSString * _Nonnull)canNotBeNilNothing {
return nil;
}
Used in Swift:
let name: String? = WKInterfaceDevice.current().canNotBeNilNothing();
print("\(String(describing: name))")
You still get the Optional(""), not nil. And it's expected, because there's this _Nonnull (it violates the contract, but it's another story).
You can create something like this if you are really sure it can return nil in Objective-C:
- (NSString * _Nullable)maybeName {
return [self name];
}
And then you can use String? in Swift and it can become nil if [self name] will return nil.
Possible causes of your problem
Bug somewhere in the WatchKit (Incorrect nullability annotation, ...)
Something else
I'm not sure what's happening, because I didn't see the stacktrace.
Possible solution
WatchKit & Objective-C problem (throws an exception)? It might be fixable with the following wrapper in Objective-C:
- (NSString * _Nullable)maybeName {
#try {
return [self name];
}
#catch (NSException *exception) {
// Return nil or handle it your way
return nil;
}
}
Bridging issue (incorrect nullability)? It might be fixable with the following code in Swift:
extension WKInterfaceDevice {
var maybeName: String? {
self.perform(#selector(getter: WKInterfaceDevice.name))?.takeRetainedValue() as! String?
}
}
1 In general, you should look at nullable and nonnull roughly the way you currently use assertions or exceptions: violating the contract is a programmer error. In particular, return values are something you control, so you should never return nil for a non-nullable return type unless it is for backwards-compatibility. (Nullability and Objective-C)
Supposed to have a completion block like
typedef void(^JSAPICallback)(id result);
and a binding class
#protocol JSProtocol<JSExport>
- (void)initAPI:(JSAPICallback)success;
#end
#interface JSObject : NSObject<JSProtocol>
- (void)initAPI:(JSAPICallback)success error:(JSAPICallback)error;
#end
#implementation JSObject
- (void)initAPI:(JSAPICallback)success {
[[API sharedInstance] initialize:^(id results, NSError *error) {
if(error==nil) {
success(results)
} else {
error()
}
}];
}
}
If I try to bind it in a JSContext in this case in a tvOS TVApplicationControllerDelegate delegate like:
- (void)appController:(TVApplicationController *)appController evaluateAppJavaScriptInContext:(JSContext *)jsContext {
JSObject *jsObject = [[JSObject alloc] init];
[jsContext setObject:jsObject forKeyedSubscript:#"jsobject"];
[jsContext setExceptionHandler:^(JSContext *context, JSValue *value) {
NSLog(#"%#", value);
}];
}
I have a crash:
2015-10-09 23:33:16.669 TestbedTV[9707:3524754] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
*** First throw call stack:
(
0 CoreFoundation 0x000000011008f105 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010fb07deb objc_exception_throw + 48
2 CoreFoundation 0x000000010ff9206e -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 318
3 CoreFoundation 0x000000010ffa43bb +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
4 JavaScriptCore 0x000000011905d388 -[JSObjCClassInfo allocateConstructorAndPrototype] + 2664
5 JavaScriptCore 0x000000011905e25f -[JSObjCClassInfo prototype] + 47
6 JavaScriptCore 0x000000011905e0ab -[JSObjCClassInfo wrapperForObject:] + 587
7 JavaScriptCore 0x000000011905e737 -[JSWrapperMap jsWrapperForObject:] + 423
8 JavaScriptCore 0x0000000118fdce80 -[JSContext(Internal) wrapperForObjCObject:] + 64
9 JavaScriptCore 0x0000000119054238 _ZL24objectToValueWithoutCopyP9JSContextP11objc_object + 760
10 JavaScriptCore 0x000000011905053a _Z13objectToValueP9JSContextP11objc_object + 74
11 JavaScriptCore 0x0000000119051ad9 -[JSValue setValue:forProperty:] + 137
12 TestbedTV 0x000000010eeb42cd -[AppDelegate appController:evaluateAppJavaScriptInContext:] + 141
13 TVMLKit 0x000000011048d3be -[TVApplicationController appContext:evaluateAppJavaScriptInContext:] + 889
14 ITMLKit 0x000000011b47d431 -[IKAppContext(JS) evaluateFoundationJS] + 2566
15 ITMLKit 0x000000011b4a56b3 -[IKAppContext _startWithScript:scriptUrl:] + 262
16 ITMLKit 0x000000011b4a52a5 -[IKAppContext _startWithURL:urlTrusted:] + 1277
17 ITMLKit 0x000000011b4a37e7 __21-[IKAppContext start]_block_invoke + 46
18 ITMLKit 0x000000011b4a6633 -[IKAppContext _sourcePerform] + 379
19 ITMLKit 0x000000011b4a647d IKRunLoopSourcePerformCallBack + 34
20 CoreFoundation 0x000000010ffbb1b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21 CoreFoundation 0x000000010ffb10dc __CFRunLoopDoSources0 + 556
22 CoreFoundation 0x000000010ffb0593 __CFRunLoopRun + 867
23 CoreFoundation 0x000000010ffaffa8 CFRunLoopRunSpecific + 488
24 CoreFoundation 0x0000000110063201 CFRunLoopRun + 97
25 ITMLKit 0x000000011b4a62ea -[IKAppContext _jsThreadMain] + 337
26 Foundation 0x000000010f79224b __NSThread__start__ + 1198
27 libsystem_pthread.dylib 0x000000011311505a _pthread_body + 131
28 libsystem_pthread.dylib 0x0000000113114fd7 _pthread_body + 0
29 libsystem_pthread.dylib 0x00000001131123ed thread_start + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
It seems that the JavaScriptCore is not able to bind the completion block. Having a simple function with simple parameters like this
#protocol JSProtocol<JSExport>
- (void)initAPI:(NSString*)options;
#end
instead the binding would work as expected.
This happens in tvOS9.0, but I think it would crash in iOS9.1 as well.
The most likely question to get some idea is ObjectiveC and JavaScriptCore: Will using this method of calling CallBacks cause memory issues?.
I can't reproduce some bug that happens sometimes. This is a report:
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 1
Thread 0:
0 libobjc.A.dylib 0x3b4b97fa objc_release + 10
1 MyApp 0x00173610 -[AFHTTPRequestOperation error] (AFHTTPRequestOperation.m:136)
2 MyApp 0x001460ea -[RKObjectRequestOperationLogger HTTPOperationDidFinish:] (RKObjectRequestOperation.m:209)
3 CoreFoundation 0x31121e6e __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 10
4 CoreFoundation 0x31095aac _CFXNotificationPost + 1716
5 Foundation 0x31a7bec0 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
6 Foundation 0x31a807c2 -[NSNotificationCenter postNotificationName:object:] + 26
7 MyApp 0x0017e44e __34-[AFURLConnectionOperation finish]_block_invoke (AFURLConnectionOperation.m:558)
8 libdispatch.dylib 0x3b9a10c0 _dispatch_call_block_and_release + 8
9 libdispatch.dylib 0x3b9a10ac _dispatch_client_callout + 20
10 libdispatch.dylib 0x3b9a39a4 _dispatch_main_queue_callback_4CF + 264
11 CoreFoundation 0x3112a5ac __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 4
12 CoreFoundation 0x31128e78 __CFRunLoopRun + 1304
13 CoreFoundation 0x3109346c CFRunLoopRunSpecific + 520
14 CoreFoundation 0x3109324e CFRunLoopRunInMode + 102
15 GraphicsServices 0x35dcd2e6 GSEventRunModal + 134
16 UIKit 0x33948840 UIApplicationMain + 1132
17 MyApp 0x00014d54 main (main.m:16)
18 libdyld.dylib 0x3b9b5ab4 start + 0
Thread 1 Crashed:
0 libsystem_kernel.dylib 0x3ba59838 kevent64 + 24
1 libdispatch.dylib 0x3b9a80d0 _dispatch_mgr_invoke + 228
2 libdispatch.dylib 0x3b9a261e _dispatch_mgr_thread + 34
What can i understand from such a record? Who can be a culprit?
AFHTTPRequestOperation.m:136 don't looks that can to cause the crash
135: - (NSError *)error {
136: if (!self.HTTPError && self.response) {
137: if (![self hasAcceptableStatusCode] || ![self hasAcceptableContentType]) {
so from where objc_release can come? Does objc_release means that ARC tries to release something from memory? In what period of time (place in code) it can be happened?
providing code of AFURLConnectionOperation.m :
- (void)finish {
self.state = AFOperationFinishedState;
dispatch_async(dispatch_get_main_queue(), ^{
558: [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self];
});
}
Try using the weakSelf code pattern with the block. A weak rather than a strong reference within the block will avoid the release, hopefully.
See the answers here:
What is the proper way to avoid Retain Cycle while using blocks
I actually like the 2nd most popular answer for async. And I really really like it because you have this method called "finish" -- if you happen to make self go away simultaneous with the block being executed, perhaps you get this error.
Hope that works for you.
Apple has rejected my app because it crashes and I can't find a way to know where the problem is. They say that the crash was on an iPhone 4 with iOS6.
I have built the archive with Xcode 4.4 and iOS 5.1. I have already upgrade to Xcode 4.5 and iOS 6. As you will see, Xcode doesn't identify the symbols on every line of the stack trace; in particular, the system function names are missing, maybe due to the update and not the same version on my computer; I don't know.
I'm just unable to reproduce this crash, I don't have an iPhone 4, just a 3GS and have no bugs.
Here is the log:
Incident Identifier: 23FCC6BC-FB56-4681-8254-E72A01891A80
CrashReporter Key: 1378004e4baa9919d5598a6dec7f08d687552155
Hardware Model: xxx
Process: Myapp [598]
Path: /var/mobile/Applications/31F1CD56-357C-4969-8DBA-F19E7D2AF638/Myapp.app/Myapp
Identifier: Myapp
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-09-26 14:40:48.221 -0700
OS Version: iOS 6.0 (10A403)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x3403129e __exceptionPreprocess + 158
1 libobjc.A.dylib 0x3380397a objc_exception_throw + 26
2 CoreFoundation 0x34031158 +[NSException raise:format:arguments:] + 96
3 Foundation 0x38ff62aa 0x38f86000 + 459434
4 UIKit 0x36c55776 0x36b66000 + 980854
5 UIKit 0x36c54fca -[UIViewController presentViewController:withTransition:completion:] + 3390
6 CoreFoundation 0x340349c0 0x33f6f000 + 809408
7 CoreFoundation 0x33f8bfe6 0x33f6f000 + 118758
8 UIKit 0x36d7372e -[_UIDelayedPresentationContext finishDelayedPresentation:] + 182
9 GameKit 0x32c1dd28 __41-[GKRemoteViewController setupRemoteView]_block_invoke_0327 + 20
10 libdispatch.dylib 0x3840a11a _dispatch_call_block_and_release + 6
11 libdispatch.dylib 0x384094b2 _dispatch_client_callout + 18
12 libdispatch.dylib 0x3840adc6 0x38408000 + 11718
13 CoreFoundation 0x34004f36 __CFRunLoopRun + 1286
14 CoreFoundation 0x33f77eb8 CFRunLoopRunSpecific + 352
15 CoreFoundation 0x33f77d44 0x33f6f000 + 36164
16 GraphicsServices 0x34ce02e6 0x34cdb000 + 21222
17 UIKit 0x36bbd2fc UIApplicationMain + 1116
18 Crossibus 0x0003cc96 main (main.m:16)
19 Crossibus 0x0003cc4c start + 36
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x32d00350 __pthread_kill + 8
1 libsystem_c.dylib 0x380db11e pthread_kill + 54
2 libsystem_c.dylib 0x3811796e abort + 90
3 libc++abi.dylib 0x38c0dd4a abort_message + 70
4 libc++abi.dylib 0x38c0aff4 default_terminate() + 20
5 libobjc.A.dylib 0x33803a74 _objc_terminate() + 144
6 libc++abi.dylib 0x38c0b078 safe_handler_caller(void (*)()) + 76
7 libc++abi.dylib 0x38c0b110 std::terminate() + 16
8 libc++abi.dylib 0x38c0c50e __cxa_throw + 118
9 libobjc.A.dylib 0x338039ba objc_exception_throw + 90
10 CoreFoundation 0x34031158 +[NSException raise:format:arguments:] + 96
11 Foundation 0x38ff62aa -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 86
12 UIKit 0x36c55776 -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:] + 166
13 UIKit 0x36c54fca -[UIViewController presentViewController:withTransition:completion:] + 3390
14 CoreFoundation 0x340349c0 __invoking___ + 64
15 CoreFoundation 0x33f8bfe6 -[NSInvocation invoke] + 282
16 UIKit 0x36d7372e -[_UIDelayedPresentationContext finishDelayedPresentation:] + 182
17 GameKit 0x32c1dd28 __41-[GKRemoteViewController setupRemoteView]_block_invoke_0327 + 20
18 libdispatch.dylib 0x3840a11c _dispatch_call_block_and_release + 8
19 libdispatch.dylib 0x384094b4 _dispatch_client_callout + 20
20 libdispatch.dylib 0x3840adc6 _dispatch_main_queue_callback_4CF$VARIANT$up + 222
21 CoreFoundation 0x34004f36 __CFRunLoopRun + 1286
22 CoreFoundation 0x33f77eb8 CFRunLoopRunSpecific + 352
23 CoreFoundation 0x33f77d44 CFRunLoopRunInMode + 100
24 GraphicsServices 0x34ce02e6 GSEventRunModal + 70
25 UIKit 0x36bbd2fc UIApplicationMain + 1116
26 Crossibus 0x0003cc96 main (main.m:16)
27 Crossibus 0x0003cc4c start + 36
Thread 1 name: Dispatch queue: com.apple.root.default-priority
Thread 1:
0 libsystem_kernel.dylib 0x32d00d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x380b25e8 pthread_workqueue_addthreads_np + 44
2 libdispatch.dylib 0x38417eb0 _dispatch_queue_wakeup_global_slow + 72
3 libdispatch.dylib 0x384097da _dispatch_wakeup$VARIANT$up + 106
4 libdispatch.dylib 0x38417a24 _dispatch_queue_push_list_slow2 + 16
5 libxpc.dylib 0x3742a820 _xpc_connection_mach_event + 828
6 libdispatch.dylib 0x38419df4 _dispatch_mach_msg_invoke$VARIANT$up + 120
7 libdispatch.dylib 0x3840995a _dispatch_queue_drain$VARIANT$up + 82
8 libdispatch.dylib 0x3841a06a _dispatch_mach_invoke$VARIANT$up + 150
9 libdispatch.dylib 0x38418212 _dispatch_root_queue_drain + 190
10 libdispatch.dylib 0x384183b4 _dispatch_worker_thread2 + 80
11 libsystem_c.dylib 0x380b2a0e _pthread_wqthread + 358
12 libsystem_c.dylib 0x380b28a0 start_wqthread + 4
Thread 2 name: Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0 libsystem_kernel.dylib 0x32cf0648 kevent64 + 24
1 libdispatch.dylib 0x384194ec _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x3840bdf4 _dispatch_mgr_thread$VARIANT$up + 32
Thread 3 name: Dispatch queue: com.apple.uikit._UIViewServiceXPCProxy 0x1ededbb0 target:<_UIQueueRedirectingProxy: 0x1ed77750; target: <_UIViewServiceFencingControlProxy: 0x1ed82fc0; target: <_UIViewServiceImplicitAnimationDecodingProxy: 0x1ed678e0; target: <_UIObjectArgumentReplacingProxy: 0x1ed6ef60; target: <_UIStrongToWeakAdapter: 0x1edae420; target: <GKRemoteAuthenticateViewController: 0x1ed6c490>>>>; suspension count: 0>; queue: 0x3bebd580 (com.apple.main-thread)>
Thread 3:
0 libobjc.A.dylib 0x33800f2a objc_release + 10
1 XPCObjects 0x37d9fc66 __destroy_helper_block_133 + 18
2 libsystem_blocks.dylib 0x3427bab0 _Block_release + 220
3 libxpc.dylib 0x374256c4 _xpc_connection_call_reply + 28
4 libdispatch.dylib 0x38409996 _dispatch_queue_drain$VARIANT$up + 142
5 libdispatch.dylib 0x38409890 _dispatch_queue_invoke$VARIANT$up + 32
6 libdispatch.dylib 0x38418212 _dispatch_root_queue_drain + 190
7 libdispatch.dylib 0x384183b4 _dispatch_worker_thread2 + 80
8 libsystem_c.dylib 0x380b2a0e _pthread_wqthread + 358
9 libsystem_c.dylib 0x380b28a0 start_wqthread + 4
Thread 4 name: WebThread
Thread 4:
0 libsystem_kernel.dylib 0x32cefeb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x32cf0048 mach_msg + 36
2 CoreFoundation 0x34006040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x34004d9e __CFRunLoopRun + 878
4 CoreFoundation 0x33f77eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x33f77d44 CFRunLoopRunInMode + 100
6 WebCore 0x34d5ba70 RunWebThread(void*) + 440
7 libsystem_c.dylib 0x380bd30e _pthread_start + 306
8 libsystem_c.dylib 0x380bd1d4 thread_start + 4
Thread 5:
0 libsystem_kernel.dylib 0x32d00d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x380b2cf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x380b2a12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x380b28a0 start_wqthread + 4
Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000 r1: 0x00000000 r2: 0x00000000 r3: 0x3be7e534
r4: 0x00000006 r5: 0x3be7eb88 r6: 0x1ed61194 r7: 0x2fdc4a14
r8: 0x1ed61170 r9: 0x00000300 r10: 0x1ed65e20 r11: 0x36ffaa2f
ip: 0x00000148 sp: 0x2fdc4a08 lr: 0x380db123 pc: 0x32d00350
cpsr: 0x00070010
Can you provide any insight into what's wrong or how to determine what's wrong?
Edit:
I think i have found, it was a problem with Game Center and IOS 6. The method "authenticateWithCompletionHandler" is deprecated and make it crash.
Thanks.
1) Your 3GS works fine and its running iOS 6, right?
2) You don't need to switch completely to Xcode4.5 if you don't want to for some reason, just install it side by side with Xcode4.4.1 and just use it to test and run your app in a Retina iPhone simulator.
3) If you still cannot get the crash, then I am going to make a wild guess that this is your problem:
5 UIKit 0x36c54fca -[UIViewController presentViewController:withTransition:completion:] + 3390
Is the presentedViewController retained in a strong variable (if using ARC), or in a retained property in the presenting ViewController? If not make it so, but then, no way to know for sure if it fixes the problem.
A good reason to build up points here is to be able to add a bounty for an answer - I believe 50 points is the min. Assuming you know Android well (given last name, isn't going to make you friends here in iOS land), answer a few question now and get some points.
With a bounty, you maybe can get someone to test your app on their phone by building an Ad Hoc version of the app (but Provisioning H*ll awaits :-( )
I receive a lot of crash reports about one specify crash but have no idea where to start to fix it, as I'm not able to reproduce it by myself and crash reports were sent anonymously.
As you'll see it has something to do with the NSFetchedResultsController I am using.
Here is an excerpt from that crash report. The only difference between the reports is the range of the indexes [...]index (someLargeIndex) beyond bounds (1)[...]. The rest stays the same in every single report.
Application Specific Information:
*** Terminating app due to uncaught exception \\\'NSRangeException\\\', reason: \\\'*** -[_PFBatchFaultingArray objectAtIndex:]: index (262144) beyond bounds (1)\\\'
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x31d1e00c __kill + 8
1 libsystem_c.dylib 0x32ac4f95 raise + 17
2 AppName 0x0003d961 uncaught_exception_handler (PLCrashReporter.m:137)
3 CoreFoundation 0x349b57d3 __handleUncaughtException + 239
4 libobjc.A.dylib 0x33f9506b _objc_terminate + 103
5 libstdc++.6.dylib 0x3338ae3d __cxxabiv1::__terminate(void (*)()) + 53
6 libstdc++.6.dylib 0x3338ae91 std::terminate() + 17
7 libstdc++.6.dylib 0x3338af61 __cxa_throw + 85
8 libobjc.A.dylib 0x33f93c8b objc_exception_throw + 71
9 CoreFoundation 0x349b5491 +[NSException raise:format:arguments:] + 69
10 CoreFoundation 0x349b54cb +[NSException raise:format:] + 35
11 CoreData 0x34820fc5 -[_PFBatchFaultingArray objectAtIndex:] + 133
12 CoreData 0x3485e5fb -[_PFMutableProxyArray objectAtIndex:] + 55
13 CoreData 0x348e00f7 +[NSFetchedResultsController(PrivateMethods) _insertIndexForObject:inArray:lowIdx:highIdx:sortDescriptors:] + 99
14 CoreData 0x348e0605 -[NSFetchedResultsController(PrivateMethods) _postprocessInsertedObjects:] + 353
15 CoreData 0x348e0ecf -[NSFetchedResultsController(PrivateMethods) _postprocessUpdatedObjects:] + 507
16 CoreData 0x348e29c7 -[NSFetchedResultsController(PrivateMethods) _managedObjectContextDidChange:] + 1239
17 Foundation 0x35f46183 _nsnote_callback + 143
18 CoreFoundation 0x3498420f __CFXNotificationPost_old + 403
19 CoreFoundation 0x3491eeeb _CFXNotificationPostNotification + 119
20 Foundation 0x35f435d3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 71
21 CoreData 0x34884c07 -[NSManagedObjectContext(_NSInternalNotificationHandling) _postObjectsDidChangeNotificationWithUserInfo:] + 55
22 CoreData 0x34884fcd -[NSManagedObjectContext(_NSInternalChangeProcessing) _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:] + 141
23 CoreData 0x34845251 -[NSManagedObjectContext(_NSInternalChangeProcessing) _postRefreshedObjectsNotificationAndClearList] + 77
24 CoreData 0x34844f7f -[NSManagedObjectContext(_NSInternalChangeProcessing) _processRecentChanges:] + 1815
25 CoreData 0x348863a5 -[NSManagedObjectContext processPendingChanges] + 17
26 CoreData 0x3482027f _performRunLoopAction + 127
27 CoreFoundation 0x3498ca35 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 17
28 CoreFoundation 0x3498e465 __CFRunLoopDoObservers + 413
29 CoreFoundation 0x3498f75b __CFRunLoopRun + 855
30 CoreFoundation 0x3491fec3 CFRunLoopRunSpecific + 231
31 CoreFoundation 0x3491fdcb CFRunLoopRunInMode + 59
32 GraphicsServices 0x3354641f GSEventRunModal + 115
33 GraphicsServices 0x335464cb GSEventRun + 63
34 UIKit 0x3357dd69 -[UIApplication _run] + 405
35 UIKit 0x3357b807 UIApplicationMain + 671
36 AppName 0x00002b69 main (main.m:15)
I'm sorry, that I'm not able to provide more information. Any suggestions how to start?
This is probably a caching issue with the NSFetchedResultsController. See this question for a little bit more: _PFBatchFaultingArray objectAtIndex:
try looking in you cellForRowAtIndexPath: or wherever you use the results from the NSFetchedResultsController. There, use the following code to see how many results are available to you:
NSArray *sections = fetchController.sections;
int someSection = 0;
id <NSFetchedResultsSectionInfo> sectionInfo = [sections objectAtIndex:someSection];
numberOfObjects = [sectionInfo numberOfObjects];
and then go to the place where you try to get the information, probably where you call:
[fetchedResultsController objectAtIndexPath:indexPath];
and see what you pass over:
NSLog(#"row to be retrieved: %d", indexPath.row);
[fetchedResultsController objectAtIndexPath:indexPath]; //here comes the crash
Eventually, you could check
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
to see how many rows are being returned.