我正在使用 Xcode 6.0 和 swift。UIAlertView 和 UIAlertController(例如:以下 2 个函数)在继承自 UIViewController 的 myViewController 上工作正常,但它们在继承自 UIInputViewController 的 KeyboardViewController 上崩溃。Apple 不允许在自定义键盘上使用 alertview 还是我的编码有任何错误?欢迎和赞赏任何回应。
func viewAlert() {
var alertView = UIAlertView() <———
alertView.addButtonWithTitle("Ok")
alertView.title = "title"
alertView.message = "message"
alertView.show()
}
func viewAlert0() {
var alert = UIAlertController() <———
alert.title = "title"
alert.message = "are disabled in your device"
alert.addAction(UIAlertAction(title: "Click", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
}
<——— debugger error point:
0x325ca19: calll 0x327e620 ; symbol stub for: pthread_kill
0x325ca1e: movl $0x2710, (%esp)
0x325ca25: calll 0x327ec50 ; symbol stub for: usleep$NOCANCEL
0x325ca2a: movl $0xffffffe7, -0xc(%ebp)
0x325ca31: movl %esi, 0x4(%esp)
0x325ca35: movl $0x0, 0x8(%esp)
0x325ca3d: movl $0x3, (%esp)
0x325ca44: calll 0x327e476 ; symbol stub for: sigprocmask
0x325ca49: ud2 <====== Thread 1 :EXC_BAD_INSTRUCTION(code=EXC_i386_INVOP,subcode=0x0)