在我的iOS应用程序中,当我尝试使用UIAlertController向用户显示一些警报信息时出现一些错误,并且在出现错误后我的进度条没有更新进度行。
我的代码如下所示:
// create the alert
let alert = UIAlertController(title: "My Title", message: "This is my message.", preferredStyle: UIAlertControllerStyle.Alert)
// add an action (button)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
// show the alert
self.presentViewController(alert, animated: true, completion: nil)
此代码在iPhone 6模拟器上的XCode版本7.3(7D175)下的UIViewController内运行。
我遇到了这种错误:
Apr 6 14:36:29 TimerApp[32952] <Error>: CGContextAddPath: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Apr 6 14:36:29 TimerApp[32952] <Error>: clip: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Apr 6 14:36:29 TimerApp[32952] <Error>: CGContextDrawLinearGradient: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Apr 6 14:36:31 TimerApp[32952] <Error>: CGContextAddPath: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Apr 6 14:36:31 TimerApp[32952] <Error>: clip: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Apr 6 14:36:31 TimerApp[32952] <Error>: CGContextDrawLinearGradient: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
我试图谷歌这个bug并发现一些帖子来更新XCode,但我的XCode是最新版本。那么我该怎么做才能避免这种错误?