Xcode: EXC_BREAKPOINT (EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29434253/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Xcode: EXC_BREAKPOINT (EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe)
提问by TheSaurus
I'm getting an EXC_BREAKPOINT (EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe) error while running my app on a iOS7 device. The thing is, it runs smoothly on iOS7 simulator.
我在 iOS7 设备上运行我的应用程序时收到 EXC_BREAKPOINT (EXC_ARM_BREAKPOINT, subcode=0xe7ffdefe) 错误。问题是,它在 iOS7 模拟器上运行流畅。
By using breakpoints, I've found the error occurs in line 6.
通过使用断点,我发现错误发生在第 6 行。
required init(coder aDecoder: NSCoder) {
personPicker = ABPeoplePickerNavigationController()
super.init(coder: aDecoder)
personPicker.peoplePickerDelegate = self
}
/*error line*/ @IBAction func BPressed(sender: AnyObject) {
self.presentViewController(personPicker, animated: true, completion: nil)
}
This error is new, and didn't appeared on my device until I've added these lines into the code;
这个错误是新的,直到我将这些行添加到代码中才出现在我的设备上;
let url = NSURL(string: urlPath)
let request = NSURLRequest(URL: url!)
NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue.mainQueue()) {(response, data, error) in
println(NSString(data: data, encoding: NSUTF8StringEncoding))
}
Also; the debugger points the error to this line:
还; 调试器将错误指向这一行:
0x16a7f0: trap
And gives this output in the console:
并在控制台中给出这个输出:
fatal error: attempt to create an Unmanaged instance from a null pointer
致命错误:尝试从空指针创建非托管实例
This error causes a black screen on device even though I've changed nothing in storyboard.
即使我没有更改故事板中的任何内容,此错误也会导致设备上出现黑屏。
Thank you for taking your time.
感谢您抽出宝贵时间。
Edit: This error showed no result in search engines, but I think it may be related to obj-c.
编辑:此错误在搜索引擎中未显示任何结果,但我认为可能与 obj-c 有关。
采纳答案by dlw
I ran across this issue today when testing some Swift code against an old iPad 2 (I think it's an iPad 2 -- it's model MD368LL/A), running iOS 8.1.3. It turned out that the problem existed everywhere that I was calling something like:
我今天在针对运行 iOS 8.1.3 的旧 iPad 2(我认为它是 iPad 2 - 它的型号为 MD368LL/A)测试一些 Swift 代码时遇到了这个问题。结果发现问题无处不在,我称之为:
Int(arc4random() % <someInt>)
This worked fine on later iPads, iPhone5S, iPhone6, etc. Fixed by changing code to:
这在后来的 iPad、iPhone5S、iPhone6 等上运行良好。通过将代码更改为:
Int(UInt32(arc4random()) % UInt32(<someInt>))
I think it was a register overflow on the older hardware.
我认为这是旧硬件上的寄存器溢出。
回答by AechoLiu
I ran into this problem, in iPhone 5
, which is iOS 10.3.3
.
我遇到了这个问题,在iPhone 5
,即iOS 10.3.3
.
let date = Date()
// Crashes in `iPhone 5`, but works in `iPhone 5s`.
let time: Int = 1000 * Int(date.timeIntervalSince1970) //< Crash due to cast `Double` to `Int`
// This crashes in `iPhone 5`, and `iPhone 5s` too.
let time: Int32 = 1000 * Int32(date.timeIntervalSince1970)
// It works fine in `iPhone 5`, and `iPhone 5s`.
let time: Int64 = 1000 * Int64(date.timeIntervalSince1970)
回答by iwasrobbed
In my case, this ended up being from a bit overflow issue if you cast too large of a number into too small of a type. E.g. Int(someNumber)
if someNumber
was an Int64
type.
就我而言,如果您将太大的数字转换为太小的类型,这最终会导致位溢出问题。例如Int(someNumber)
ifsomeNumber
是一种Int64
类型。
iPhone 5c break at the offending line of code:
iPhone 5c 在有问题的代码行处中断: