IOS 6 Maps Crash - objective-c

I keep getting this crash on IOS 6 but I am not sure what is wrong. Does anyone know what it means?
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: EXC_ARM_DA_ALIGN at 0x00000001
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 CoreFoundation 0x3bcab0d8 CFRetain + 20
1 CoreFoundation 0x3bd424ee __CFSetStandardRetainKey + 50
2 VectorKit 0x3840e97c -[VKAnimation _stopAnimation:] + 36
3 VectorKit 0x383d841c -[VKAnimation onTimerFired:] + 48
4 VectorKit 0x383d8240 -[VKMainLoop displayTimerFired:] + 352
5 QuartzCore 0x3664377c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156
6 QuartzCore 0x366436d4 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 60
7 IOMobileFramebuffer 0x3c497fd4 IOMobileFramebufferVsyncNotifyFunc + 152
8 IOKit 0x35a965aa IODispatchCalloutFromCFMessage + 190
9 CoreFoundation 0x3bd35888 __CFMachPortPerform + 116
10 CoreFoundation 0x3bd403e4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
11 CoreFoundation 0x3bd40386 __CFRunLoopDoSource1 + 134
12 CoreFoundation 0x3bd3f20a __CFRunLoopRun + 1378
13 CoreFoundation 0x3bcb2238 CFRunLoopRunSpecific + 352
14 CoreFoundation 0x3bcb20c4 CFRunLoopRunInMode + 100
15 GraphicsServices 0x33eae336 GSEventRunModal + 70
16 UIKit 0x3be33284 UIApplicationMain + 1116
17 App Name 0x000dcb88 main (main.m:14)
18 App Name 0x000dcb54 start + 36
The application is using the MKMapkit in IOS 6.

This is an internal bug. Report this to Apple.
You may be able to use the Simulator's "Reset Content" thing (in the app/iOS Simulator menu) to clear out caches if this is happening in the Simulator.

Looks like the issue is caused by accessing a released object from within or soon after VectorKit's stopAnimation: method is called. I'm not familiar with VectorKit, so you might look in that method or what looks to be the onTimerFired: delegate callback.
Good luck.
Tim

Related

How can I solve unconditionallyBridgeFromObjectiveC crash when storing a String value? (WKInterfaceDevice.current().name)

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)

What is the reason of the crash at CFNetWork _CFURLRequestCopyContentDispositionEncodingFallbackArray

This crash is from crash report of app. Multiple URL requests crash cause of it. I want to figure out how to repeat the crash and why the crash happened.
Incident Identifier: 4A2BA2B1-9174-410F-9D51-88A151884484
CrashReporter Key: TODO
Hardware Model: iPhone8,1
Code Type: ARM-64
Parent Process: ??? [1]
Date/Time: 2016-09-28 02:43:26 +0000
OS Version: iPhone OS 10.0.2 (14A456)
Report Version: 104
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x0
Crashed Thread: 21
Thread 21 Crashed:
0 CFNetwork _CFURLRequestCopyContentDispositionEncodingFallbackArray + 48
1 CFNetwork HTTPProtocol::updateForHeader(__CFHTTPMessage*) + 260
2 CFNetwork HTTPProtocol::performHeaderReadPostProcessing(__CFHTTPMessage*, unsigned char) + 156
3 CFNetwork HTTPProtocol::performHeaderRead(__CFHTTPMessage*) + 992
4 CFNetwork HTTPProtocol::handleStreamEvent(__CFHTTPMessage*, dispatch_data_s*, CFStreamError const*) + 496
5 CFNetwork ___ZN15HTTPTransaction22_onqueue_invokeHandlerEv_block_invoke.64 + 60
6 libdispatch.dylib _dispatch_client_callout + 16
7 libdispatch.dylib _dispatch_block_invoke_direct + 376
8 CFNetwork RunloopBlockContext::_invoke_block(void const*, void*) + 36
9 CoreFoundation CFArrayApplyFunction + 68
10 CFNetwork RunloopBlockContext::perform() + 136
11 CFNetwork MultiplexerSource::perform() + 312
12 CFNetwork MultiplexerSource::_perform(void*) + 64
13 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
14 CoreFoundation __CFRunLoopDoSources0 + 524
15 CoreFoundation __CFRunLoopRun + 804
16 CoreFoundation CFRunLoopRunSpecific + 444
17 CFNetwork +[NSURLConnection(Loader) _resourceLoadLoop:] + 336
18 Foundation __NSThread__start__ + 1024
19 libsystem_pthread.dylib _pthread_body + 240
20 libsystem_pthread.dylib _pthread_body + 0
21 libsystem_pthread.dylib thread_start + 4

App is crashing when home button clicked

I have a strage crash scenario to crash the app!
When you do a fresh install by running the app from Xcode; the application will run perfectly.
But I installed by current app from app store, then run the application, now everything is perfect till you click on home button, the application will crash at that moment! What's the problem? And How could I solve it?
UPDATED (This is the log):
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x6f687370
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 ??? 0x6f687370 0 + 1869116272
1 CoreFoundation 0x291ad93c _CFXNotificationPost + 1784
2 Foundation 0x29edd9b8 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
3 UIKit 0x2c99b7ae -[UIApplication _handleApplicationDectivationWithScene:shouldForceExit:transitionContext:completion:] + 882
4 UIKit 0x2c9a29f0 __88-[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:]_block_invoke + 76
5 UIKit 0x2c9a299c -[UIApplication _handleApplicationLifecycleEventWithScene:transitionContext:completion:] + 360
6 UIKit 0x2c997c82 -[UIApplication scene:didUpdateWithDiff:transitionContext:completion:] + 478
7 FrontBoardServices 0x2f9a21f8 __80-[FBSSceneImpl updater:didUpdateSettings:withDiff:transitionContext:completion:]_block_invoke_2 + 40
8 FrontBoardServices 0x2f9b10e8 __31-[FBSSerialQueue performAsync:]_block_invoke + 12
9 CoreFoundation 0x2925f5b4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
10 CoreFoundation 0x2925e878 __CFRunLoopDoBlocks + 216
11 CoreFoundation 0x2925d3b2 __CFRunLoopRun + 1714
12 CoreFoundation 0x291ab620 CFRunLoopRunSpecific + 476
13 CoreFoundation 0x291ab432 CFRunLoopRunInMode + 106
14 GraphicsServices 0x305310a8 GSEventRunModal + 136
15 UIKit 0x2c796358 UIApplicationMain + 1440
16 MyNiceTestApp 0x000cae9e 0xc4000 + 28318
17 libdyld.dylib 0x371bfaae start + 2
Since there is not source code to look at my guess would be you have registered for
an observer for NSNotificationCenter and you have not removed the observer before the
application terminates.
This will cause you problems if an NSNotification was delivered to a deallocated
listener.
It appears one of UIApplicationDidEnterBackgroundNotification listeners is deallocated without unregistering from observing UIApplicationDidEnterBackgroundNotification notification

App works on iPhone Simulator, but crashes on real iPhone Device

Today i tried running my app on my iPhone device, and it crashed! It worked perfectly fine on the simulator, I don't know what the problem is.
These are the crash logs:
Identifier: Evader
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2012-09-13 16:41:54.656 -0700
OS Version: iPhone OS 5.1.1 (9B206)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x377d888f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x354dd259 objc_exception_throw + 33
2 CoreFoundation 0x377d8789 +[NSException raise:format:] + 1
3 Foundation 0x380173a3 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 91
4 Evader 0x0012ca41 -[CCSprite initWithTexture:] (CCSprite.m:192)
5 Evader 0x0012c1b1 +[CCSprite spriteWithTexture:] (CCSprite.m:83)
6 Evader 0x0011eb3d -[CCProgressTimer initWithTexture:] (CCProgressTimer.m:69)
7 Evader 0x0011ea55 -[CCProgressTimer initWithFile:] (CCProgressTimer.m:59)
8 Evader 0x0011e9e1 +[CCProgressTimer progressWithFile:] (CCProgressTimer.m:55)
9 Evader 0x00173579 -[HelloWorldLayer lives] (HelloWorldLayer.m:256)
10 Evader 0x001723ed -[HelloWorldLayer init] (HelloWorldLayer.m:101)
11 Evader 0x0010f073 +[CCNode node] (CCNode.m:258)
12 Evader 0x0017bd11 -[StartMenu doThis:] (StartMenu.m:75)
13 CoreFoundation 0x377db7e4 __invoking___ + 68
14 CoreFoundation 0x377367b1 -[NSInvocation invoke] + 161
15 Evader 0x0010aa03 -[CCMenuItem activate] (CCMenuItem.m:129)
16 Evader 0x001085ff -[CCMenu ccTouchEnded:withEvent:] (CCMenu.m:198)
17 CoreFoundation 0x377323fd -[NSObject performSelector:withObject:withObject:] + 53
18 Evader 0x0014f4ff -[CCTouchDispatcher touches:withEvent:withTouchType:] (CCTouchDispatcher.m:268)
19 Evader 0x0014fc43 -[CCTouchDispatcher touchesEnded:withEvent:] (CCTouchDispatcher.m:338)
20 Evader 0x001515c3 -[EAGLView touchesEnded:withEvent:] (EAGLView.m:332)
21 UIKit 0x314c692b -[UIWindow _sendTouchesForEvent:] + 319
22 UIKit 0x314c6319 -[UIWindow sendEvent:] + 381
23 UIKit 0x314ac695 -[UIApplication sendEvent:] + 357
24 UIKit 0x314abf3b _UIApplicationHandleEvent + 5827
25 GraphicsServices 0x33eee22b PurpleEventCallback + 883
26 CoreFoundation 0x377ac523 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 39
27 CoreFoundation 0x377ac4c5 __CFRunLoopDoSource1 + 141
28 CoreFoundation 0x377ab313 __CFRunLoopRun + 1371
29 CoreFoundation 0x3772e4a5 CFRunLoopRunSpecific + 301
30 CoreFoundation 0x3772e36d CFRunLoopRunInMode + 105
31 GraphicsServices 0x33eed439 GSEventRunModal + 137
32 UIKit 0x314dacd5 UIApplicationMain + 1081
33 Evader 0x00171029 main (main.m:14)
34 Evader 0x000dec68 start + 40
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3198f32c __pthread_kill + 8
1 libsystem_c.dylib 0x3408c208 pthread_kill + 48
2 libsystem_c.dylib 0x34085298 abort + 88
3 libc++abi.dylib 0x36f12f64 abort_message + 40
4 libc++abi.dylib 0x36f10346 _ZL17default_terminatev + 18
5 libobjc.A.dylib 0x354dd350 _objc_terminate + 140
6 libc++abi.dylib 0x36f103be _ZL19safe_handler_callerPFvvE + 70
7 libc++abi.dylib 0x36f1044a std::terminate() + 14
8 libc++abi.dylib 0x36f1181e __cxa_rethrow + 82
9 libobjc.A.dylib 0x354dd2a2 objc_exception_rethrow + 6
10 CoreFoundation 0x3772e506 CFRunLoopRunSpecific + 398
11 CoreFoundation 0x3772e366 CFRunLoopRunInMode + 98
12 GraphicsServices 0x33eed432 GSEventRunModal + 130
13 UIKit 0x314dacce UIApplicationMain + 1074
14 Evader 0x00171022 main (main.m:14)
15 Evader 0x000dec60 start + 32
I have tried to look for the error, but I do not know what to look for. Can someone help solve this problem?
CCSprite initWithTexture: raises the exception that causes your app to exit. I'm not entirely up on Cocos2d but a quick check in the documentation suggests it raises exceptions on failure to find named files.
That being the case, I'd guess the problem is simply one of filename case. Macs are by default case insensitive. So if you have FunnyImage.png then the simulator will succeed if you attempt to load funnyimage.png.
iOS devices are case sensitive. So it will fail if you attempt to load funnyimage.png.
So probably what you want to do is check that all the filenames you've used in code exactly match the case of the actual files.

iOS crash log is only partially symbolicated

Here's the issue. I have the .xarchive with all the DSYMs but for whatever reason using symbolicatecrash or xcode is only converting some of the symbols to lines while leaving other ones unconverted. Any ideas? I'm using xCode 4.3.2 on OS X Lion.
For example, from a crash log from the appstore
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x37f0e628 _semwait_signal + 24
1 libsystem_c.dylib 0x33d66b1a nanosleep
2 libsystem_c.dylib 0x33d71608 sleep
3 AudioToolbox 0x362b7abc AudioQueueNew(bool, AudioStreamBasicDescription const*, TCACallback const&, CACallbackTarget const&, unsigned long, OpaqueAudioQueue*)
4 AudioToolbox 0x362b77da AudioQueueNewOutput
5 AVFoundation 0x359b718e allocAudioQueue(AVAudioPlayer*, AudioPlayerImpl*)
6 AVFoundation 0x359b54b4 prepareToPlayQueue(AVAudioPlayer*, AudioPlayerImpl*)
7 AVFoundation 0x359b5a3c playQueue(AVAudioPlayer*, AudioPlayerImpl*, AudioTimeStamp const*)
8 AVFoundation 0x359b58d2 -[AVAudioPlayer play]
9 APP_ 0x00049ffe 0x00049ffe
10 APP_ 0x0004fbfe 0x0004fbfe
11 APP_ 0x00051b9a 0x00051b9a
12 APP_ 0x00016462 0x00016462
13 Foundation 0x3704f92c _NSFireDelayedPerform
14 CoreFoundation 0x3156aa2c _CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
15 CoreFoundation 0x3156a692 _CFRunLoopDoTimer
16 CoreFoundation 0x31569268 CFRunLoopRun + 1200
17 CoreFoundation 0x314ec49e CFRunLoopRunSpecific
18 CoreFoundation 0x314ec366 CFRunLoopRunInMode
19 GraphicsServices 0x329c5432 GSEventRunModal
20 UIKit 0x317f1cce UIApplicationMain
21 APP 0x000032c0 0x000032c0
22 APP_ 0x00003270 0x00003270
Symbolicated:
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x37f0e628 _semwait_signal + 24
1 libsystem_c.dylib 0x33d66b1a nanosleep + 138
2 libsystem_c.dylib 0x33d71608 sleep + 40
3 AudioToolbox 0x362b7abc _ZL13AudioQueueNewbPK27AudioStreamBasicDescriptionRK11TCACallbackIPvS3_ERK16CACallbackTargetmPP16OpaqueAudioQueue + 680
4 AudioToolbox 0x362b77da AudioQueueNewOutput + 126
5 AVFoundation 0x359b718e _ZL15allocAudioQueueP13AVAudioPlayerP15AudioPlayerImpl + 86
6 AVFoundation 0x359b54b4 _ZL18prepareToPlayQueueP13AVAudioPlayerP15AudioPlayerImpl + 20
7 AVFoundation 0x359b5a3c ZL9playQueueP13AVAudioPlayerP15AudioPlayerImplPK14AudioTimeStamp + 184
8 AVFoundation 0x359b58d2 -[AVAudioPlayer play] + 162
9 APP 0x00049ffe 0x00049ffe
10 APP_ 0x0004fbfe 0x0004fbfe
11 APP_ 0x00051b9a 0x00051b9a
12 APP_ 0x00016462 -[BackpackSetupViewController scenario] (BackpackSetupViewController.m:167)
13 Foundation 0x3704f92c _NSFireDelayedPerform + 408
14 CoreFoundation 0x3156aa2c _CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION_ + 8
15 CoreFoundation 0x3156a692 _CFRunLoopDoTimer + 358
16 CoreFoundation 0x31569268 CFRunLoopRun + 1200
17 CoreFoundation 0x314ec49e CFRunLoopRunSpecific + 294
18 CoreFoundation 0x314ec366 CFRunLoopRunInMode + 98
19 GraphicsServices 0x329c5432 GSEventRunModal + 130
20 UIKit 0x317f1cce UIApplicationMain + 1074
21 APP 0x000032c0 main (main.m:14)
22 APP_ 0x00003270 0x00003270