specialized UIViewController calling some method crashing iOS Swift - ios

I am unable to replicate this issue, how to replicate the following fabric crash ?
Is there a way to open this crash in xcode (Importing crash into xcode)
Crashed: com.apple.main-thread
0 ABCC 0x10092d0c4 specialized ABCViewController.signInBtnPressed(UIButton) -> ()(ABCViewController.swift:178)
1 ABCC 0x10092a520 #objc ABCViewController.unwind(UIStoryboardSegue) -> () + 3152641510
2 UIKit 0x18aced64c -[UIApplication sendAction:to:from:forEvent:] + 86
3 UIKit 0x18ae0e870 -[UIControl sendAction:to:forEvent:] + 52
4 UIKit 0x18acf3700 -[UIControl _sendActionsForEvents:withEvent:] + 120
5 UIKit 0x18ae291a8 -[UIControl touchesEnded:withEvent:] + 492
6 UIKit 0x18b2ceee8 _UIGestureEnvironmentSortAndSendDelayedTouches + 4340
7 UIKit 0x18b2cbc60 _UIGestureEnvironmentUpdate + 1236
8 UIKit 0x18ad664d8 -[UIGestureEnvironment _deliverEvent:toGestureRecognizers:usingBlock:] + 404
9 UIKit 0x18ad66010 -[UIGestureEnvironment _updateGesturesForEvent:window:] + 276
10 UIKit 0x18ad65874 -[UIWindow sendEvent:] + 3132
11 UIKit 0x18ad641d0 -[UIApplication sendEvent:] + 340
12 UIKit 0x18b545d1c __dispatchPreprocessedEventFromEventQueue + 2340
13 UIKit 0x18b5482c8 __handleEventQueueInternal + 4744
14 CoreFoundation 0x180f27404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
15 CoreFoundation 0x180f26c2c __CFRunLoopDoSources0 + 276
16 CoreFoundation 0x180f2479c __CFRunLoopRun + 1204
17 CoreFoundation 0x180e44da8 CFRunLoopRunSpecific + 552
18 GraphicsServices 0x182e2a020 GSEventRunModal + 100
19 UIKit 0x18ae64758 UIApplicationMain + 236
20 ABCC 0x1007b28c4 main (main.m:20)
21 libdyld.dylib 0x1808d5fc0 start + 4
Here is the code for the action that is crashing.
#IBAction func signInBtnPressed(_ sender: UIButton) {
sender.isUserInteractionEnabled = false
guard let employees = UserService.shared.employees, let name = employees.names?[sender.tag] else {
sender.isUserInteractionEnabled = true // crashing here
return
}
// perform task
sender.isUserInteractionEnabled = true
}

Related

Scope for Crashed: com.apple.main-thread EXC_BREAKPOINT on ViewController Initialisation

This is my stack trace on fabric:
Crashed: com.apple.main-thread.
EXC_BREAKPOINT 0x0000000100b9ac64
Crashed: com.apple.main-thread
0 ABC 0x100b9ac64 specialized GameItemViewController.init(coder : NSCoder) -> GameItemViewController? (GameItemViewController.swift:5)
1 ABC 0x100b952f0 #objc GameItemViewController.init(coder : NSCoder) -> GameItemViewController? (GameItemViewController.swift)
2 UIKit 0x18cb6dedc -[UIClassSwapper initWithCoder:] + 248
3 UIKit 0x18cccf628 UINibDecoderDecodeObjectForValue + 688
4 UIKit 0x18cccf360 -[UINibDecoder decodeObjectForKey:] + 312
5 UIKit 0x18cb6db84 -[UIRuntimeConnection initWithCoder:] + 188
6 UIKit 0x18cb6e31c -[UIRuntimeEventConnection initWithCoder:] + 64
7 UIKit 0x18cccf628 UINibDecoderDecodeObjectForValue + 688
8 UIKit 0x18cccf7a0 UINibDecoderDecodeObjectForValue + 1064
9 UIKit 0x18cccf360 -[UINibDecoder decodeObjectForKey:] + 312
10 UIKit 0x18cb6ced4 -[UINib instantiateWithOwner:options:] + 1164
11 UIKit 0x18ce79d88 -[UIStoryboard instantiateViewControllerWithIdentifier:] + 196
12 UIKit 0x18ce86610 -[UIStoryboardSegueTemplate instantiateOrFindDestinationViewControllerWithSender:] + 92
13 UIKit 0x18ce8686c -[UIStoryboardSegueTemplate _perform:] + 56
14 UIKit 0x18c99f4d0 -[UIViewController performSegueWithIdentifier:sender:] + 108
15 ABC 0x100b66788 GamesViewController.gameTapped(Any) -> () (GamesViewController.swift:225)
16 ABC 0x100b66a84 #objc GamesViewController.gameTapped(Any) -> () + 4300515972
17 UIKit 0x18c65a6c8 -[UIApplication sendAction:to:from:forEvent:] + 96
18 UIKit 0x18c77b8a4 -[UIControl sendAction:to:forEvent:] + 80
19 UIKit 0x18c66077c -[UIControl _sendActionsForEvents:withEvent:] + 440
20 UIKit 0x18c7961dc -[UIControl touchesEnded:withEvent:] + 572
21 UIKit 0x18c6dda48 -[UIWindow _sendTouchesForEvent:] + 2428
22 UIKit 0x18c6d28f8 -[UIWindow sendEvent:] + 3160
23 UIKit 0x18c6d1238 -[UIApplication sendEvent:] + 340
24 UIKit 0x18ceb2c0c __dispatchPreprocessedEventFromEventQueue + 2340
25 UIKit 0x18ceb51b8 __handleEventQueueInternal + 4744
26 UIKit 0x18ceae258 __handleHIDEventFetcherDrain + 152
27 CoreFoundation 0x1828d3404 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
28 CoreFoundation 0x1828d2c2c __CFRunLoopDoSources0 + 276
29 CoreFoundation 0x1828d079c __CFRunLoopRun + 1204
30 CoreFoundation 0x1827f0da8 CFRunLoopRunSpecific + 552
31 GraphicsServices 0x1847d3020 GSEventRunModal + 100
32 UIKit 0x18c7d178c UIApplicationMain + 236
33 ABC 0x100b28f60 main (GamesViewModel.swift:11)
34 libdyld.dylib 0x182281fc0 start + 4
The crash occurs when i segue between GamesViewController and GameItemViewController.
I don't have any asynchronous task in my IBAction logic where i start the actual segue. I just check for 3 different booleans and start different ViewControllers respectively.
#IBAction func gameTapped(_ sender: Any) {
if x {
performSegue(withIdentifier: "x", sender: nil)
} else if y {
performSegue(withIdentifier: "y", sender: nil)
} else {
performSegue(withIdentifier: "showGameItem", sender: nil)
}
}
This line which the crash points to (GameItemViewController.swift:5) is the view controller declaration like so:
import UIKit
import RxSwift
import RxCocoa
class GameItemViewController: UIViewController {
}
Also i have NOT overridden the
init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?
OR
required init?(coder aDecoder: NSCoder)
I'm not able to recreate this, however I can see logs on crashlytics with multiple devices having the issue.

Click on button in table cell crash at IBAction ios

I am having three buttons in table view cell when click on button it is crashed strangely in line I am attaching code and crash report please suggest a solution.
Code for button click:
#IBAction func ibaReject(sender: UIButton) {
let notification = notifications[sender.tag]
let notificationHandler = NotificationHandlerFactory.getNotificationHandler(notification)
notificationHandler?.handleNegativeAction(notification,viewController: self)
}
Crash report from crashlytics:
Crashed: com.apple.main-thread
0 Quickride 0x1000c589c specialized NotificationViewController.ibaReject(UIButton) -> () (NotificationViewController.swift)
1 Quickride 0x1000c2d28 #objc NotificationViewController.ibaReject(UIButton) -> () (NotificationViewController.swift)
2 UIKit 0x18d31e7b0 -[UIApplication sendAction:to:from:forEvent:] + 96
3 UIKit 0x18d31e730 -[UIControl sendAction:to:forEvent:] + 80
4 UIKit 0x18d308be4 -[UIControl _sendActionsForEvents:withEvent:] + 452
5 UIKit 0x18d31e01c -[UIControl touchesEnded:withEvent:] + 584
6 UIKit 0x18d31db44 -[UIWindow _sendTouchesForEvent:] + 2484
7 UIKit 0x18d318d8c -[UIWindow sendEvent:] + 2988
8 UIKit 0x18d2e9858 -[UIApplication sendEvent:] + 340
9 UIKit 0x18dad6cb8 __dispatchPreprocessedEventFromEventQueue + 2736
10 UIKit 0x18dad0720 __handleEventQueue + 784
11 CoreFoundation 0x18744e278 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
12 CoreFoundation 0x18744dbc0 __CFRunLoopDoSources0 + 524
13 CoreFoundation 0x18744b7c0 __CFRunLoopRun + 804
14 CoreFoundation 0x18737a048 CFRunLoopRunSpecific + 444
15 GraphicsServices 0x188dfd198 GSEventRunModal + 180
16 UIKit 0x18d354628 -[UIApplication _run] + 684
17 UIKit 0x18d34f360 UIApplicationMain + 208
18 Quickride 0x1002d4018 main (AppDelegate.swift:23)
19 libdispatch.dylib 0x18635c5b8 (Missing)

Understanding Swift stacktrace in Crashlytics

So, as a novice IOS developer I find it hard to determine what cases this exception.
Case: the IOS app has a UIScrollView that allows the user to drag down to sync with a web service - just like the build in mail app.
Once in a while a user in the wild will encounter an app crash. In crashlytics i see:
Crashed: com.apple.main-thread: EXC_BREAKPOINT 0x00000000e7ffdefe
0 myApp 0xba760 specialized WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift:428)
1 myApp 0xba4a0 specialized WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift:428)
2 myApp 0xb702c #objc WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift)
3 UIKit 0x2cee4ad3 -[UIScrollView _updatePanGesture] + 282
4 UIKit 0x2ced206b _UIGestureRecognizerSendActions + 294
5 UIKit 0x2cd810f9 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 668
6 UIKit 0x2d19af9b ___UIGestureRecognizerUpdate_block_invoke661 + 46
7 UIKit 0x2cd4a181 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 216
8 UIKit 0x2cd4805f _UIGestureRecognizerUpdate + 2926
9 UIKit 0x2cd7f4d9 -[UIWindow _sendGesturesForEvent:] + 784
10 UIKit 0x2cd7eddd -[UIWindow sendEvent:] + 524
11 UIKit 0x2cd54fe5 -[UIApplication sendEvent:] + 196
12 UIKit 0x2cfcb8fb _UIApplicationHandleEventFromQueueEvent + 14414
13 UIKit 0x2cd539f9 _UIApplicationHandleEventQueue + 1352
14 CoreFoundation 0x296c5faf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
15 CoreFoundation 0x296c53bf __CFRunLoopDoSources0 + 218
16 CoreFoundation 0x296c3a25 __CFRunLoopRun + 772
17 CoreFoundation 0x29610201 CFRunLoopRunSpecific + 476
18 CoreFoundation 0x29610013 CFRunLoopRunInMode + 106
19 GraphicsServices 0x30eef201 GSEventRunModal + 136
20 UIKit 0x2cdb4a59 UIApplicationMain + 1440
21 myApp 0x5d084 main (AppDelegate.swift:14)
22 libdyld.dylib 0x37f3daaf start + 2
This is the code from the controller:
func scrollViewWillBeginDragging(scrollView: UIScrollView){
if Settings.isSyncActive {
if let lastSyncDate = Settings.lastSyncedDate { // ln 427
self.refreshControl.attributedTitle = NSAttributedString(string: "Last sync \(lastSyncDate.relativeTimeToString()) ago") // ln 428
} // ln 429
else{
self.refreshControl.attributedTitle = NSAttributedString(string: "")
}
}
}
Any hint or tips are appreciated

Understanding an iOS stacktrace

I'm kinda new to debugging iOS exceptions.
On the fabric.io site I can see that a few users has seen this crash.
Can anyone please help me get started?
Crashed: com.apple.main-thread
0 gismoapp 0x114760 specialized WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift:428)
1 gismoapp 0x1144a0 specialized WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift:428)
2 gismoapp 0x11102c #objc WeekPlanController.scrollViewWillBeginDragging(UIScrollView) -> () (WeekPlanController.swift)
3 UIKit 0x261b4609 -[UIScrollView(UIScrollViewInternal) _scrollViewWillBeginDragging] + 232
4 UIKit 0x261b3a9d -[UIScrollView _updatePanGesture] + 284
5 UIKit 0x265685db _UIGestureRecognizerSendTargetActions + 142
6 UIKit 0x261a08e3 _UIGestureRecognizerSendActions + 170
7 UIKit 0x26030d15 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 1004
8 UIKit 0x2656993f ___UIGestureRecognizerUpdate_block_invoke898 + 62
9 UIKit 0x25ff1587 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 298
10 UIKit 0x25fedaf9 _UIGestureRecognizerUpdate + 2920
11 UIKit 0x2602ec01 -[UIWindow _sendGesturesForEvent:] + 904
12 UIKit 0x2602e3b3 -[UIWindow sendEvent:] + 622
13 UIKit 0x25ffec85 -[UIApplication sendEvent:] + 204
14 UIKit 0x25ffd229 _UIApplicationHandleEventQueue + 5016
15 CoreFoundation 0x219efa67 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
16 CoreFoundation 0x219ef657 __CFRunLoopDoSources0 + 454
17 CoreFoundation 0x219ed9bf __CFRunLoopRun + 806
18 CoreFoundation 0x2193c289 CFRunLoopRunSpecific + 516
19 CoreFoundation 0x2193c07d CFRunLoopRunInMode + 108
20 GraphicsServices 0x22f58af9 GSEventRunModal + 160
21 UIKit 0x260672c5 UIApplicationMain + 144
22 gismoapp 0xb7084 main (AppDelegate.swift:14)
23 libdispatch.dylib 0x215e8873 (Missing)
The code in question:
func scrollViewWillBeginDragging(scrollView: UIScrollView){
if let lastSyncDate = Settings.lastSyncedDate {
// This is line 428 in WeekPlanController
self.refreshControl.attributedTitle = NSAttributedString(string: "last synced \(lastSyncDate.relativeTimeToString()) ago")
}
}

EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000c

my application keeps crashing because of the below error. I tried debugging it but am not able to understand why is it caused and how to debug and remove this..
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x335cef46 objc_msgSend + 5
1 UIKit 0x29307c2b -[UIApplication sendAction:to:from:forEvent:] + 70
2 UIKit 0x29307bd1 -[UIControl sendAction:to:forEvent:] + 44
3 UIKit 0x292f2863 -[UIControl _sendActionsForEvents:withEvent:] + 582
4 UIKit 0x2930763d -[UIControl touchesEnded:withEvent:] + 588
5 UIKit 0x29307317 -[UIWindow _sendTouchesForEvent:] + 522
6 UIKit 0x29300be1 -[UIWindow sendEvent:] + 544
7 UIKit 0x292d73dd -[UIApplication sendEvent:] + 196
8 UIKit 0x2954ac29 _UIApplicationHandleEventFromQueueEvent + 13888
9 UIKit 0x292d5e39 _UIApplicationHandleEventQueue + 1296
10 CoreFoundation 0x25dde377 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
11 CoreFoundation 0x25ddd787 __CFRunLoopDoSources0 + 218
12 CoreFoundation 0x25ddbded __CFRunLoopRun + 772
13 CoreFoundation 0x25d2a211 CFRunLoopRunSpecific + 476
14 CoreFoundation 0x25d2a023 CFRunLoopRunInMode + 106
15 GraphicsServices 0x2d1230a9 GSEventRunModal + 136
16 UIKit 0x293361d1 UIApplicationMain + 1440
17 Application 0x000ffefb main (main.m:17)

Resources