Can anyone help me diagnose this crash. It happens in the animation block on the layoutIfNeeded() function call. Full function and crash report attached.
It seems to be related to memory but I can't pin it down.
private func showWarningView() {
DispatchQueue.main.async { [weak self] in
guard let strongSelf = self else { return }
if let safeAreaHeight = strongSelf.superview?.safeAreaLayoutGuide.layoutFrame.size.height {
let visibleBannerHeight: CGFloat = strongSelf.isBannerVisible ? strongSelf.bannerHeight : 0
let newConstraintConstant = (safeAreaHeight - strongSelf.externalBottomOffset - visibleBannerHeight) - strongSelf.warningBannerHeight
strongSelf.addInternalBottomOffset(with: strongSelf.warningBannerHeight)
strongSelf.warningViewTopConstraint.constant = newConstraintConstant
}
strongSelf.isWarningViewVisible = true
let showWarningView = UIViewPropertyAnimator(duration: 0.25, curve: .easeIn, animations: {
self?.layoutIfNeeded() // <---- Crash Happens here
})
showWarningView.startAnimation()
}
}
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010 Exception Codes: 0x0000000000000001, 0x0000000000000010 VM Region Info: 0x10 is not in any region. Bytes before following region: 4337303536
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 102860000-102864000 [ 16K] r-x/r-x SM=COW ... Exception Note: EXC_CORPSE_NOTIFY Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [265]
Triggered by Thread: 0
Kernel Triage:
VM - Compressor failed a blocking pager_get
Thread 0 name:
Thread 0 Crashed:
0 libobjc.A.dylib 0x00000001d5d22f40 objc_msgSend + 32
1 UIKitCore 0x00000001bf72d010 -[UIView(AdditionalLayoutSupport) _nsis_center:bounds:inEngine:forLayoutGuide:] + 112 (NSLayoutConstraint_UIKitAdditions.m:3513)
2 UIKitCore 0x00000001bf7455b0 -[UILayoutGuide _updateLayoutFrameInOwningView:fromEngine:] + 80 (UILayoutGuide.m:109)
3 UIKitCore 0x00000001bf6c8350 -[UIView(AdditionalLayoutSupport) _is_layout] + 320 (NSLayoutConstraint_UIKitAdditions.m:3173)
4 UIKitCore 0x00000001bf5b1a7c -[UIView _updateConstraintsAsNecessaryAndApplyLayoutFromEngine] + 1028 (UIView.m:12933)
5 UIKitCore 0x00000001bf5a9fb4 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2592 (UIView.m:18426)
6 QuartzCore 0x00000001c0d20cd0 CA::Layer::layout_if_needed(CA::Transaction*) + 532 (CALayer.mm:10116)
7 UIKitCore 0x00000001bf60dd90 -[UIView(Hierarchy) layoutBelowIfNeeded] + 584 (UIView.m:12868)
8 ****** 0x0000000102eb59d4 closure #1 in closure #1 in BottomDrawView.showWarningView() + 52 (BottomDrawView.swift:410)
9 ****** 0x0000000102eb59d4 partial apply for closure #1 in closure #1 in BottomDrawView.showWarningView() + 68 (:0)
10 ****** 0x0000000102f33378 thunk for #escaping #callee_guaranteed () -> () + 20 (:0)
11 UIKitCore 0x00000001bf8ee77c -[UIViewPropertyAnimator _runAnimations] + 212 (UIViewPropertyAnimator.m:1912)
12 UIKitCore 0x00000001bf78c6a4 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke_2 + 108 (UIViewPropertyAnimator.m:3279)
13 UIKitCore 0x00000001bf637fec __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke + 128 (UIViewPropertyAnimator.m:3267)
14 UIKitCore 0x00000001bfb6eba8 __49-[UIViewPropertyAnimator startAnimationAsPaused:]_block_invoke.1142 + 284 (UIViewPropertyAnimator.m:3276)
15 UIKitCore 0x00000001bf95fa20 -[UIViewPropertyAnimator _setupAnimationTracking:] + 132 (UIViewPropertyAnimator.m:3230)
16 UIKitCore 0x00000001bf4c146c -[UIViewPropertyAnimator startAnimationAsPaused:] + 1048 (UIViewPropertyAnimator.m:3334)
17 ****** 0x0000000102eb4868 closure #1 in BottomDrawView.showWarningView() + 460 (BottomDrawView.swift:412)
18 ****** 0x0000000102f33378 thunk for #escaping #callee_guaranteed () -> () + 20 (:0)
19 libdispatch.dylib 0x00000001bcca2e6c _dispatch_call_block_and_release + 32 (init.c:1517)
20 libdispatch.dylib 0x00000001bcca4a30 _dispatch_client_callout + 20 (object.m:560)
21 libdispatch.dylib 0x00000001bccb2f48 _dispatch_main_queue_drain + 928 (inline_internal.h:2622)
22 libdispatch.dylib 0x00000001bccb2b98 _dispatch_main_queue_callback_4CF + 44 (queue.c:7770)
23 CoreFoundation 0x00000001bcff5800 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1795)
24 CoreFoundation 0x00000001bcfaf704 __CFRunLoopRun + 2532 (CFRunLoop.c:3144)
25 CoreFoundation 0x00000001bcfc2bc8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
26 GraphicsServices 0x00000001d90f6374 GSEventRunModal + 164 (GSEvent.c:2200)
27 UIKitCore 0x00000001bf932648 -[UIApplication _run] + 1100 (UIApplication.m:3511)
28 UIKitCore 0x00000001bf6b3d90 UIApplicationMain + 364 (UIApplication.m:5064)
29 ****** 0x0000000102864a08 main + 68 (AppDelegate.swift:22)
30 dyld 0x0000000104505ce4 start + 520 (dyldMain.cpp:879)
Related
I'm working on developing an application that requires the use of Mapbox turn-by-turn navigation. I've had to create a custom react native module to help me achieve this, but I think somewhere along my implementation is causing some issues pushing the phone to overheat and eventually crash.
Here's my crash report:
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: FRONTBOARD; [2343432205]
<RBSTerminateContext| domain:10 code:0x8BADF00D explanation:scene-update watchdog transgression: application<org.name.appName>:27065 exhausted real (wall clock) time allowance of 10.00 seconds
ProcessVisibility: Foreground
ProcessState: Running
WatchdogEvent: scene-update
WatchdogVisibility: Background
WatchdogCPUStatistics: (
"Elapsed total CPU time (seconds): 40.290 (user 19.790, system 20.500), 67% CPU",
"Elapsed application CPU time (seconds): 1.558, 3% CPU"
) reportType:CrashLog maxTerminationResistance:Interactive>
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x1b7fd9f90 __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1f1c9e254 _pthread_cond_wait + 1228
2 libc++.1.dylib 0x199207ddc std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28
3 libc++.1.dylib 0x199208984 std::__1::__assoc_sub_state::__sub_wait(std::__1::unique_lock<std::__1::mutex>&) + 56
4 libc++.1.dylib 0x1992088d4 std::__1::__assoc_sub_state::copy() + 56
5 libc++.1.dylib 0x199208c18 std::__1::future<void>::get() + 32
6 Mapbox 0x10532a3e0 0x1052e8000 + 271328
7 Mapbox 0x1056ac72c 0x1052e8000 + 3950380
8 CoreFoundation 0x1808aef88 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 28
9 CoreFoundation 0x18094ac3c ___CFXRegistrationPost_block_invoke + 52
10 CoreFoundation 0x18091dff4 _CFXRegistrationPost + 456
11 CoreFoundation 0x1808c4df4 _CFXNotificationPost + 716
12 Foundation 0x1820c3f58 -[NSNotificationCenter postNotificationName:object:userInfo:] + 96
13 UIKitCore 0x182f93aec __47-[UIApplication _applicationDidEnterBackground]_block_invoke + 316
14 UIKitCore 0x182ef2ecc +[UIViewController _performWithoutDeferringTransitionsAllowingAnimation:actions:] + 164
15 UIKitCore 0x18312bdcc -[UIApplication _applicationDidEnterBackground] + 144
16 UIKitCore 0x182f21278 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke_2 + 840
17 UIKitCore 0x182edbaf0 _UIScenePerformActionsWithLifecycleActionMask + 104
18 UIKitCore 0x183007438 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 224
19 UIKitCore 0x183128104 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 248
20 UIKitCore 0x1833692f8 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 760
21 UIKitCore 0x1832f4818 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 340
22 UIKitCore 0x182edc8f4 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 196
23 UIKitCore 0x182f9d160 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 892
24 UIKitCore 0x182ede804 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 276
25 UIKitCore 0x182fc9448 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 384
26 UIKitCore 0x1834515cc __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.613 + 776
27 UIKitCore 0x182f0d13c -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 256
28 UIKitCore 0x182f50a50 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 288
29 UIKitCore 0x182eda834 -[UIApplicationSceneClientAgent scene:handleEvent:withCompletion:] + 492
30 FrontBoardServices 0x192567b30 -[FBSScene updater:didUpdateSettings:withDiff:transitionContext:completion:] + 528
31 FrontBoardServices 0x19258077c __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke_2 + 152
32 FrontBoardServices 0x19256506c -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 240
33 FrontBoardServices 0x19256b540 __94-[FBSWorkspaceScenesClient _queue_updateScene:withSettings:diff:transitionContext:completion:]_block_invoke + 396
34 libdispatch.dylib 0x18058f670 _dispatch_client_callout + 20
35 libdispatch.dylib 0x180593128 _dispatch_block_invoke_direct + 264
36 FrontBoardServices 0x1925669c4 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 48
37 FrontBoardServices 0x192565d8c -[FBSSerialQueue _targetQueue_performNextIfPossible] + 220
38 FrontBoardServices 0x19256a414 -[FBSSerialQueue _performNextFromRunLoopSource] + 28
39 CoreFoundation 0x18093f0d0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
40 CoreFoundation 0x18094fd90 __CFRunLoopDoSource0 + 208
41 CoreFoundation 0x18088a104 __CFRunLoopDoSources0 + 376
42 CoreFoundation 0x18088f8a4 __CFRunLoopRun + 820
43 CoreFoundation 0x1808a3468 CFRunLoopRunSpecific + 600
44 GraphicsServices 0x19c44738c GSEventRunModal + 164
45 UIKitCore 0x1832465d0 -[UIApplication _run] + 1100
46 UIKitCore 0x182fc4f74 UIApplicationMain + 364
47 appName 0x104368880 0x104364000 + 18560
48 dyld 0x104f19aa4 start + 520
And here's my code:
#objc func tappedButton(sender: UIButton) {
guard let routeResponse = routeResponse, let navigationRouteOptions = routeOptions else { return }
let parentVC = self.parentViewController
let navigationOptions = NavigationOptions(simulationMode: .never)
let navigationViewController = NavigationViewController(for: routeResponse, routeIndex: 0,
routeOptions: navigationRouteOptions, navigationOptions: navigationOptions)
navigationViewController.delegate = self
parentVC!.addChild(navigationViewController)
self.addSubview(navigationViewController.view)
navigationViewController.view.frame = self.bounds
navigationViewController.didMove(toParent: parentVC)
self.navigationViewController = navigationViewController
}
I needed to add the child this way with to get it to work with react native since I can't create the native module as a UIViewController with the main app being a UIViewController.
I added this to create a parentVC:
extension UIView {
var parentViewController: UIViewController? {
var parentResponder: UIResponder? = self
while parentResponder != nil {
parentResponder = parentResponder!.next
if let viewController = parentResponder as? UIViewController {
return viewController
}
}
return nil
}
}
Any help would be greatly appreciated!
I had crash when open push notification. crash log from apple. where is a problem
Help read this log
I just open "OrderDetailsVC" when user open push
xception Type: EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000001028b15f8
Termination Signal: Trace/BPT trap: 5
Termination Reason: Namespace SIGNAL, Code 0x5
Terminating Process: exc handler [870]
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 Moitane 0x00000001028b15f8 OrderDetailsVC.viewDidLoad() + 268 (OrderDetailsVC.swift:144)
1 Moitane 0x00000001028b1618 #objc OrderDetailsVC.viewDidLoad() + 28 (<compiler-generated>:0)
2 UIKitCore 0x00000001bdf7ae08 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 100 (UIViewController.m:2283)
3 UIKitCore 0x00000001bdf7f898 -[UIViewController loadViewIfRequired] + 936 (UIViewController.m:3382)
4 UIKitCore 0x00000001bdf7fca0 -[UIViewController view] + 28 (UIViewController.m:3404)
5 UIKitCore 0x00000001bdedf528 -[UINavigationController _startCustomTransition:] + 1180 (UINavigationController.m:1893)
6 UIKitCore 0x00000001bdef33f0 -[UINavigationController _startDeferredTransitionIfNeeded:] + 688 (UINavigationController.m:6719)
7 UIKitCore 0x00000001bdef4790 -[UINavigationController __viewWillLayoutSubviews] + 172 (UINavigationController.m:6988)
8 UIKitCore 0x00000001bded7cf0 -[UILayoutContainerView layoutSubviews] + 224 (UILayoutContainerView.m:86)
9 UIKitCore 0x00000001bea6ec7c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2144 (UIView.m:17176)
10 QuartzCore 0x00000001c10084ac -[CALayer layoutSublayers] + 284 (CALayer.mm:9644)
11 QuartzCore 0x00000001c100e604 CA::Layer::layout_if_needed(CA::Transaction*) + 468 (CALayer.mm:9518)
12 QuartzCore 0x00000001c1019148 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 140 (CALayer.mm:2468)
13 QuartzCore 0x00000001c0f61e34 CA::Context::commit_transaction(CA::Transaction*, double) + 296 (CAContextInternal.mm:1992)
14 QuartzCore 0x00000001c0f8b7c4 CA::Transaction::commit() + 676 (CATransactionInternal.mm:438)
15 QuartzCore 0x00000001c0f8c1d8 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 92 (CATransactionInternal.mm:890)
16 CoreFoundation 0x00000001ba492fb8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32 (CFRunLoop.c:1758)
17 CoreFoundation 0x00000001ba48deac __CFRunLoopDoObservers + 420 (CFRunLoop.c:1868)
18 CoreFoundation 0x00000001ba48e328 __CFRunLoopRun + 968 (CFRunLoop.c:2910)
19 CoreFoundation 0x00000001ba48dc34 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3192)
20 GraphicsServices 0x00000001c45d738c GSEventRunModal + 160 (GSEvent.c:2246)
21 UIKitCore 0x00000001be5c022c UIApplicationMain + 1932 (UIApplication.m:4820)
22 Moitane 0x0000000102887b70 main + 68 (LocalizableBtn.swift:19)
23 libdyld.dylib 0x00000001ba315800 start + 4
Your viewDidLoad in OrderDetailsVC.swift (frames 1 and 2 of the stack trace) are the culprit:
0 Moitane 0x00000001028b15f8 OrderDetailsVC.viewDidLoad() + 268 (OrderDetailsVC.swift:144)
1 Moitane 0x00000001028b1618 #objc OrderDetailsVC.viewDidLoad() + 28 (<compiler-generated>:0)
Here is the code where the crash had occurred :-
private func dispatchMessageImmediately(topicName : String, mqttMessage : MQTTMessage){
AppDelegate.getAppDelegate().log.debug("Message: \(String(describing: mqttMessage.payloadString))")
let listener = self.topicToListenerMap?[topicName]
if listener != nil {
DispatchQueue.main.async(execute: { () -> Void in
MessageDispatchUtils.dispatchMessageToListeners(topicName: topicName, mqttMessage: mqttMessage, topicListener: listener!)
})
}
}
The Xcode version I am using is 9.3. My os version is iOS 11.4.1 Device is iPhone 5s. The crash is caused in libswift.dylib
Here is the crash report for the crash.Any help? Thanks in advance
Crashed: com.apple.main-thread
0 libsystem_platform.dylib 0x18358de38 _os_unfair_lock_recursive_abort + 36
1 libsystem_platform.dylib 0x18358ebb8 _os_unfair_lock_lock_slow + 264
2 libobjc.A.dylib 0x182b45720 objc_object::sidetable_clearDeallocating() + 104
3 libobjc.A.dylib 0x182b349d8 objc_destructInstance + 140
4 libswiftCore.dylib 0x10263ec0c swift_deallocClassInstance + 32
5 libswiftCore.dylib 0x10263eb4c _swift_release_dealloc + 28
6 Razorpay 0x1020f09b0 _T08Razorpay0A13UtilFunctionsC24handleUnhandledExceptionys5Int32V16havingSignalCode_SS03andI4NametFZTf4nnd_n + 248
7 libsystem_platform.dylib 0x183590b48 _sigtramp + 36
8 libobjc.A.dylib 0x182b45740 objc_object::sidetable_clearDeallocating() + 136
9 libobjc.A.dylib 0x182b45740 objc_object::sidetable_clearDeallocating() + 136
10 libobjc.A.dylib 0x182b349d8 objc_destructInstance + 140
11 libswiftCore.dylib 0x10263ec0c swift_deallocClassInstance + 32
12 libswiftCore.dylib 0x10263eb4c _swift_release_dealloc + 28
13 libswiftCore.dylib 0x1025750ec specialized String.debugDescription.getter + 4580
14 libswiftCore.dylib 0x1024bd66c protocol witness for CustomDebugStringConvertible.debugDescription.getter in conformance String + 290904
15 libswiftCore.dylib 0x1023da008 _debugPrint_unlocked<A, B>(_:_:) + 252544
16 libswiftCore.dylib 0x10257bc04 specialized _debugPrint<A>(_:separator:terminator:to:) + 31996
17 libswiftCore.dylib 0x10245a8fc Optional.debugDescription.getter + 68296
18 libswiftCore.dylib 0x10245aa4c protocol witness for CustomStringConvertible.description.getter in conformance <A> A! + 68632
19 libswiftCore.dylib 0x10257bf44 specialized _print_unlocked<A, B>(_:_:) + 32828
20 Quickride 0x10090c37c implicit closure #1 in EventServiceProxy.dispatchMessageImmediately(topicName:mqttMessage:) (EventServiceProxy.swift:238)
21 Quickride 0x1009186c4 partial apply for implicit closure #1 in EventServiceProxy.onNewMessageArrived(mqttMessage:) + 4314498756
22 XCGLogger 0x1021b86f4 _T09XCGLoggerAAC5loglnyAB5LevelO_SS12functionNameSS04fileE0Si10lineNumbers10DictionaryVySSypG8userInfoypSgyc7closuretFTf4ngXgXnggn_n + 232
23 XCGLogger 0x1021b3bac _T09XCGLoggerAAC7verboseyypSgyXK_s12StaticStringV12functionNameAF04fileF0Si10lineNumbers10DictionaryVySSypG8userInfotFTm + 500
24 XCGLogger 0x1021b2aa8 _T09XCGLoggerAAC5debugyypSgyXK_s12StaticStringV12functionNameAF04fileF0Si10lineNumbers10DictionaryVySSypG8userInfotF + 32
25 Quickride 0x100915144 specialized EventServiceProxy.dispatchMessageImmediately(topicName:mqttMessage:) (EventServiceProxy.swift:238)
26 Quickride 0x100916918 specialized EventServiceProxy.onNewMessageArrived(mqttMessage:) (EventServiceProxy.swift:145)
27 Quickride 0x10090d8c8 protocol witness for MqttCallback.onNewMessageArrived(mqttMessage:) in conformance EventServiceProxy (EventServiceProxy.swift)
28 Quickride 0x100cf309c specialized closure #1 in closure #4 in EventServiceConnection.createMqttConfig() (EventServiceConnection.swift:100)
29 Quickride 0x100cf29f4 partial apply for closure #1 in closure #4 in EventServiceConnection.createMqttConfig() (EventServiceConnection.swift)
30 Quickride 0x1008c19fc thunk for #callee_owned () -> () (RideManagementModuleSessonHandler.swift)
31 libdispatch.dylib 0x183260aa0 _dispatch_call_block_and_release + 24
32 libdispatch.dylib 0x183260a60 _dispatch_client_callout + 16
33 libdispatch.dylib 0x18326d65c _dispatch_main_queue_callback_4CF$VARIANT$mp + 1012
34 CoreFoundation 0x183917070 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
35 CoreFoundation 0x183914bc8 __CFRunLoopRun + 2272
36 CoreFoundation 0x183834da8 CFRunLoopRunSpecific + 552
37 GraphicsServices 0x18581a020 GSEventRunModal + 100
38 UIKit 0x18d854758 UIApplicationMain + 236
39 Quickride 0x1007d4bf0 main (AppDelegate.swift:26)
40 libdyld.dylib 0x1832c5fc0 start + 4
I got a crash report, which is about unrecognized selector sent to instance when saving MKMapItem into Data Store. According to MKMapItem documents(MKMapItem Document), it conforms to NSSecureCoding, which means that it should have no problem to save it into an NSManagedObject instance. it looks fine on ios 11 version, as i didn't receive crash report from the device with this version. Also, I walkthrough the feature that possibly saving MKMapItem on my phone. the context does save the NKMapItem into data store and the feature is working. Since my phone is running IOS 11, so I am thinking it could be about the version system??
Please correct me if misunderstand something.
Here is the crash report.
OS Version: iPhone OS 10.3.3 (14G60)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x181646fe0 __exceptionPreprocess + 124 (NSException.m:165)
1 libobjc.A.dylib 0x1800a8538 objc_exception_throw + 56 (objc-exception.mm:521)
2 CoreFoundation 0x18164def4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:328)
3 CoreFoundation 0x18164af54 ___forwarding___ + 916 (NSForwarding.m:3126)
4 CoreFoundation 0x181546d4c _CF_forwarding_prep_0 + 92
5 Foundation 0x18209afd4 _encodeObject + 1176 (NSKeyedArchiver.m:873)
6 Foundation 0x1820a1e9c +[NSKeyedArchiver archivedDataWithRootObject:] + 168 (NSKeyedArchiver.m:421)
7 CoreData 0x18391ae28 -[NSSQLiteConnection execute] + 1952 (NSSQLiteConnection.m:4165)
8 CoreData 0x1839520e4 -[NSSQLiteConnection insertRow:] + 456 (NSSQLiteConnection.m:2966)
9 CoreData 0x183ae3df8 _writeChangesForSaveRequest + 824 (NSSQLCore_Functions.m:1561)
10 CoreData 0x183ae5584 _executeSaveChangesRequest + 388 (NSSQLCore_Functions.m:1622)
11 CoreData 0x183adb5f0 -[NSSQLSaveChangesRequestContext executeRequestUsingConnection:] + 44 (NSSQLSaveChangesRequestContext.m:103)
12 CoreData 0x1839f30c4 __52-[NSSQLDefaultConnectionManager handleStoreRequest:]_block_invoke + 256 (NSSQLConnectionManager.m:305)
13 libdispatch.dylib 0x1804fe9a0 _dispatch_client_callout + 16 (object.m:473)
14 libdispatch.dylib 0x18050bee0 _dispatch_barrier_sync_f_invoke + 84 (queue.c:3446)
15 CoreData 0x1839f2f64 -[NSSQLDefaultConnectionManager handleStoreRequest:] + 208 (NSSQLConnectionManager.m:290)
16 CoreData 0x183ab5824 -[NSSQLCoreDispatchManager routeStoreRequest:] + 272 (NSSQLCoreDispatchManager.m:56)
17 CoreData 0x183a2075c -[NSSQLCore dispatchRequest:withRetries:] + 236 (NSSQLCore.m:2726)
18 CoreData 0x183a1c578 -[NSSQLCore processSaveChanges:forContext:] + 200 (NSSQLCore.m:1569)
19 CoreData 0x183920f10 -[NSSQLCore executeRequest:withContext:error:] + 724 (NSSQLCore.m:1923)
20 CoreData 0x1839ff84c __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 3492 (NSPersistentStoreCoordinator.m:2820)
21 CoreData 0x1839f80f0 -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 276 (NSPersistentStoreCoordinator.m:586)
22 CoreData 0x183920adc -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 408 (NSPersistentStoreCoordinator.m:2706)
23 CoreData 0x18394197c -[NSManagedObjectContext save:] + 2548 (NSManagedObjectContext.m:1419)
24 myappName 0x10009421c coreDataManager.saveContext() + 92 (coreDataManager.swift:514)
25 myappName 0x1000b5970 closure #1 in eventUpdateManager.observeValue(forKeyPath:of:change:context:) + 64 (eventUpdateManager.swift:138)
26 myappName 0x100124924 thunk for #escaping #callee_guaranteed () -> () + 36 (customAnimationController.swift:0)
27 libdispatch.dylib 0x1804fe9e0 _dispatch_call_block_and_release + 24 (init.c:963)
28 libdispatch.dylib 0x1804fe9a0 _dispatch_client_callout + 16 (object.m:473)
29 libdispatch.dylib 0x1805035e8 _dispatch_main_queue_callback_4CF + 996 (inline_internal.h:2431)
30 CoreFoundation 0x1815f50c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1793)
31 CoreFoundation 0x1815f2ce4 __CFRunLoopRun + 1572 (CFRunLoop.c:3004)
32 CoreFoundation 0x181522da4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
33 GraphicsServices 0x182f8d074 GSEventRunModal + 100 (GSEvent.c:2245)
34 UIKit 0x1877ddc9c UIApplicationMain + 208 (UIApplication.m:4089)
35 myappName 0x10005da1c main + 56 (receiptCollectionViewCell.swift:18)
36 libdyld.dylib 0x18053159c start + 4
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000180641014 __pthread_kill + 8
1 libsystem_pthread.dylib 0x000000018070b264 pthread_kill + 112 (pthread.c:1366)
2 libsystem_c.dylib 0x00000001805b59c4 abort + 140 (abort.c:91)
3 myappName 0x0000000100170ac8 uncaught_exception_handler + 72
4 CoreFoundation 0x0000000181647354 __handleUncaughtException + 628 (NSException.m:218)
5 libobjc.A.dylib 0x00000001800a8814 _objc_terminate() + 112 (objc-exception.mm:656)
6 myappName 0x0000000100155408 MSCrashesUncaughtCXXTerminateHandler() + 732 (MSCrashesCXXExceptionHandler.mm:171)
7 libc++abi.dylib 0x00000001800975d4 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:68)
8 libc++abi.dylib 0x00000001800971a8 __cxa_rethrow + 144 (cxa_exception.cpp:584)
9 libobjc.A.dylib 0x00000001800a86f8 objc_exception_rethrow + 44 (objc-exception.mm:559)
10 CoreData 0x0000000183941cb0 -[NSManagedObjectContext save:] + 3368 (NSManagedObjectContext.m:1548)
11 myappName 0x000000010009421c coreDataManager.saveContext() + 92 (coreDataManager.swift:514)
12 myappName 0x00000001000b5970 closure #1 in eventUpdateManager.observeValue(forKeyPath:of:change:context:) + 64 (eventUpdateManager.swift:138)
13 myappName 0x0000000100124924 thunk for #escaping #callee_guaranteed () -> () + 36 (customAnimationController.swift:0)
14 libdispatch.dylib 0x00000001804fe9e0 _dispatch_call_block_and_release + 24 (init.c:963)
15 libdispatch.dylib 0x00000001804fe9a0 _dispatch_client_callout + 16 (object.m:473)
16 libdispatch.dylib 0x00000001805035e8 _dispatch_main_queue_callback_4CF + 996 (inline_internal.h:2431)
17 CoreFoundation 0x00000001815f50c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1793)
18 CoreFoundation 0x00000001815f2ce4 __CFRunLoopRun + 1572 (CFRunLoop.c:3004)
19 CoreFoundation 0x0000000181522da4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
20 GraphicsServices 0x0000000182f8d074 GSEventRunModal + 100 (GSEvent.c:2245)
21 UIKit 0x00000001877ddc9c UIApplicationMain + 208 (UIApplication.m:4089)
22 myappName 0x000000010005da1c main + 56 (receiptCollectionViewCell.swift:18)
23 libdyld.dylib 0x000000018053159c start + 4
While testing on device (Apple Watch) attempting to save an HKWorkout into HealthKit I am adding samples of distance samples, calories, heart rates and vo2Max to the workout. Unfortunately unlike this question I am not getting as detailed as a trace back...as far as I can tell it's crashing on adding a sample but I can't tell which sample it is or why?
Code:
private func addSamples(toWorkout workout: HKWorkout, from startDate: Date, to endDate: Date, handler: #escaping (Bool, Error?) -> Void) {
let vo2MaxSample = HKQuantitySample(type: HKQuantityType.quantityType(forIdentifier: HKQuantityTypeIdentifier.vo2Max)!, quantity: vo2MaxQuantity(), start: startDate, end: endDate)
var samples = [HKQuantitySample]()
for distanceWalkingRunningSample in distanceWalkingRunningSamples {
samples.append(distanceWalkingRunningSample)
}
for energySample in energySamples {
samples.append(energySample)
}
samples.append(vo2MaxSample)
samples.append(contentsOf: heartRateValues)
// Add samples to workout
healthStore.add(samples, to: workout) { (success: Bool, error: Error?) in
if error != nil {
print("Adding workout subsamples failed with error: \(String(describing: error))")
handler(false, error)
}
if success {
print("Success, samples have been added, workout Saved.") //WorkoutStartDate = \(workout.startDate) WorkoutEndDate = \(workout.endDate)
handler(true, nil)
} else {
print("Adding workout subsamples failed no error reported")
handler(false, nil)
}
}
}
Trace:
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0
Application Specific Information:
abort() called
Filtered syslog:
None found
Last Exception Backtrace:
0 CoreFoundation 0x1bdf75e8 __exceptionPreprocess + 124
1 libobjc.A.dylib 0x1b15717c objc_exception_throw + 33
2 CoreFoundation 0x1bdf752c +[NSException raise:format:] + 103
3 HealthKit 0x273dbdde -[HKObject _validateForCreation] + 111
4 HealthKit 0x273dbc48 +[HKObject _newDataObjectWithMetadata:device:config:] + 219
5 HealthKit 0x273dbb30 +[HKSample _newSampleWithType:startDate:endDate:device:metadata:config:] + 159
6 HealthKit 0x273e9ba8 +[HKWorkout _workoutWithActivityType:startDate:endDate:workoutEvents:duration:totalActiveEnergyBurned:totalBasalEnergyBurned:totalDistance:totalSwimmingStrokeCount:totalFlightsClimbed:goalType:goal:device:metadata:config:] + 431
7 HealthKit 0x274a9342 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:device:metadata:] + 109
8 HealthKit 0x274a9160 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:metadata:] + 87
9 Watch Extension 0x002b7ecc 0x290000 + 163532
10 Watch Extension 0x002b79fc 0x290000 + 162300
11 Watch Extension 0x002bb7ac 0x290000 + 178092
12 Watch Extension 0x002ab9e8 0x290000 + 113128
13 Watch Extension 0x002a9660 0x290000 + 104032
14 Watch Extension 0x002a8f68 0x290000 + 102248
15 Watch Extension 0x002a7748 0x290000 + 96072
16 libdispatch.dylib 0x1b8875ec _dispatch_call_block_and_release + 5
17 libdispatch.dylib 0x1b8875c8 _dispatch_client_callout + 1
18 libdispatch.dylib 0x1b897822 _dispatch_main_queue_callback_4CF$VARIANT$mp + 853
19 CoreFoundation 0x1bdb31ac __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 5
20 CoreFoundation 0x1bdb0f42 __CFRunLoopRun + 929
21 CoreFoundation 0x1bcfe96a CFRunLoopRunSpecific + 349
22 GraphicsServices 0x1d8beb92 GSEventRunModal + 89
23 UIKit 0x21f556da UIApplicationMain + 151
24 libxpc.dylib 0x1bb2fd78 _xpc_objc_main + 581
25 libxpc.dylib 0x1bb31720 xpc_main + 149
26 Foundation 0x1c7bbf24 -[NSXPCListener resume] + 175
27 PlugInKit 0x22ccbf40 -[PKService run] + 709
28 WatchKit 0x2b5777b8 main + 157
29 libdyld.dylib 0x1b8e2b8e 0x1b8df000 + 15246
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x1b9e443c __pthread_kill + 8
1 libsystem_pthread.dylib 0x1baec270 pthread_kill$VARIANT$mp + 334
2 libsystem_c.dylib 0x1b96d28e abort + 106
3 libc++abi.dylib 0x1b136cfe __cxa_bad_cast + 0
4 libc++abi.dylib 0x1b136e8a default_unexpected_handler+ 16010 () + 0
5 libobjc.A.dylib 0x1b1573e0 _objc_terminate+ 29664 () + 102
6 libc++abi.dylib 0x1b1493fc std::__terminate(void (*)+ 91132 ()) + 6
7 libc++abi.dylib 0x1b148ed6 __cxxabiv1::exception_cleanup_func+ 89814 (_Unwind_Reason_Code, _Unwind_Exception*) + 0
8 libobjc.A.dylib 0x1b157274 _objc_exception_destructor+ 29300 (void*) + 0
9 CoreFoundation 0x1bdf7530 -[NSException initWithCoder:] + 0
10 HealthKit 0x273dbde2 -[HKObject _validateForCreation] + 116
11 HealthKit 0x273dbc4c +[HKObject _newDataObjectWithMetadata:device:config:] + 224
12 HealthKit 0x273dbb34 +[HKSample _newSampleWithType:startDate:endDate:device:metadata:config:] + 164
13 HealthKit 0x273e9bac +[HKWorkout _workoutWithActivityType:startDate:endDate:workoutEvents:duration:totalActiveEnergyBurned:totalBasalEnergyBurned:totalDistance:totalSwimmingStrokeCount:totalFlightsClimbed:goalType:goal:device:metadata:config:] + 436
14 HealthKit 0x274a9346 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:device:metadata:] + 114
15 HealthKit 0x274a9164 +[HKWorkout workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:metadata:] + 92
16 Watch Extension 0x002b7ed0 0x290000 + 163536
17 Watch Extension 0x002b7a00 0x290000 + 162304
18 Watch Extension 0x002bb7b0 0x290000 + 178096
19 Watch Extension 0x002ab9ec 0x290000 + 113132
20 Watch Extension 0x002a9664 0x290000 + 104036
21 Watch Extension 0x002a8f6c 0x290000 + 102252
22 Watch Extension 0x002a774c 0x290000 + 96076
23 libdispatch.dylib 0x1b8875f0 _dispatch_call_block_and_release + 10
24 libdispatch.dylib 0x1b8875cc _dispatch_client_callout + 6
25 libdispatch.dylib 0x1b897826 _dispatch_main_queue_callback_4CF$VARIANT$mp + 858
26 CoreFoundation 0x1bdb31b0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 10
27 CoreFoundation 0x1bdb0f46 __CFRunLoopRun + 934
28 CoreFoundation 0x1bcfe96e CFRunLoopRunSpecific + 354
29 GraphicsServices 0x1d8beb96 GSEventRunModal + 94
30 UIKit 0x21f556de UIApplicationMain + 156
31 libxpc.dylib 0x1bb2fd7c _xpc_objc_main + 586
32 libxpc.dylib 0x1bb31724 xpc_main + 154
33 Foundation 0x1c7bbf28 service_connection_handler + 0
34 PlugInKit 0x22ccbf44 -[PKService run] + 714
35 WatchKit 0x2b5777bc main + 162
36 libdyld.dylib 0x1b8e2b92 start + 2