I was writing up code for animating UI elements in my app. The app worked fine until I changed the alpha on certain UI elements, when I got this error:
libc++abi.dylib: terminating with uncaught exception of type NSException
There was no stack trace or indication of where the error might be in the output, just a Signal SIGABRT pointing to the AppDelegate class.
The app worked on the previous build and all I changed after that was the alpha settings, which I undid to try and debug the situation. I have tried disabling certain parts of code I recently modified such as Game Center and I have tried setting breakpoints but cannot get the app to work.
My Question - What is this error and where is it coming from?
Here is some code I recently modified if you need to see it:
//This code is called in a Game Center Authentication method
UIView.animate(withDuration: 0.5, animations: {
self.pointsIndicator.center.x += self.view.bounds.width
// self.pointsIndicator.alpha = 1
})
UIView.animate(withDuration: 0.5, delay: 0.3, options: [], animations: {
self.pointsLabel.center.x += self.view.bounds.width
// self.pointsLabel.alpha = 1
}, completion: nil)
View Will Appear:
override func viewWillAppear(_ animated: Bool) {
//Setup animations
print("\(progBar.center.x) Before")
pointsIndicator.center.x -= view.bounds.width
pointsLabel.center.x -= view.bounds.width
progBar.center.x -= view.bounds.width
masterLabel.center.x -= view.bounds.width
pointsIndicator.alpha = 0
pointsLabel.alpha = 0
progBar.alpha = 0
masterLabel.alpha = 0
}
UPDATE: I ran the bt command on the debugger. This is the output:
* thread #1: tid = 0x6646da, 0x0000000110607e6e libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0000000110607e6e libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x000000011063e8fb libsystem_pthread.dylib`pthread_kill + 90
frame #2: 0x00000001103570b3 libsystem_c.dylib`abort + 129
frame #3: 0x000000010fe6243a libc++abi.dylib`abort_message + 266
frame #4: 0x000000010fe86a9f libc++abi.dylib`default_terminate_handler() + 267
frame #5: 0x000000010985359f libobjc.A.dylib`_objc_terminate() + 103
frame #6: 0x000000010fe83c09 libc++abi.dylib`std::__terminate(void (*)()) + 8
frame #7: 0x000000010fe83894 libc++abi.dylib`__cxa_rethrow + 99
frame #8: 0x00000001098534b7 libobjc.A.dylib`objc_exception_rethrow + 40
frame #9: 0x0000000106c07bf1 CoreFoundation`CFRunLoopRunSpecific + 433
frame #10: 0x0000000107d4ac00 UIKit`-[UIApplication _run] + 459
frame #11: 0x0000000107d50e8b UIKit`UIApplicationMain + 159
* frame #12: 0x000000010681423f MathsRobot LearnMaths`main + 111 at AppDelegate.swift:19
frame #13: 0x00000001102ab6bd libdyld.dylib`start + 1
frame #14: 0x00000001102ab6bd libdyld.dylib`start + 1
UPDATE: AppDelegate:19
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Credit to jeromeshr over on Apple forums. Was running into this with some Objective-C code called from a Cocoapod from Swift code. If you have the OS_ACTIVITY_MODE flag set as an environment variable, this will block the correct stack trace from showing. It's set on all my apps to avoid an endless stream of non-useful information in the console. Just uncheck the box next to it (you don't have to delete it) while you're debugging.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With