我正在编写关于在我的应用中为UI元素添加动画效果的代码。在修改某些UI元素的透明度时,出现了如下错误:
libc++abi.dylib: terminating with uncaught exception of type NSException
没有堆栈跟踪或指示错误可能在哪里,只有一个指向AppDelegate类的Signal SIGABRT。
该应用程序在先前的版本上工作,并且在那之后我更改的是alpha设置,之后我撤消了更改以尝试调试情况。我已尝试禁用某些我最近修改的代码部分(如Game Center),并尝试设置断点,但无法使应用程序正常工作。
我的问题 - 这是什么错误,它从何而来?
如果您需要查看,请参阅此处最近修改的一些代码:
//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)
视图将要出现:
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
}
更新: 我在调试器上运行了bt命令。这是输出结果:
* 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
更新:AppDelegate:19
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {