iOS 崩溃,EXC_BREAKPOINT,Xcode 6.1 不知道

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26573312/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:00:31  来源:igfitidea点击:

iOS crash, EXC_BREAKPOINT, No clue with Xcode 6.1

iosxcodeswiftcrashcrash-reports

提问by Devous

I am usually able to solve the crashes but here I have not clue from where it comes from.

我通常能够解决崩溃,但在这里我不知道它来自哪里。

I use parse, and I am simply doing a request in background with a completion block. The app crashes at a simple if condition and I can barely identify anything, no way to print description, ... Do you have any idea ? A starting point ? anything ? Xcode 6.1 is really strange, it seems that the debugger is buggy.

我使用解析,我只是在后台使用完成块执行请求。应用程序在一个简单的 if 条件下崩溃,我几乎无法识别任何东西,无法打印描述,......你有什么想法吗?一个起点?任何事物 ?Xcode 6.1 真的很奇怪,调试器好像有问题。

Here is the log of the crash :

这是崩溃的日志:

    Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x000000019657a964 __kill + 8
1   MyAPP                           0x00000001001f2b70 0x10009c000 + 1403760
2   libsystem_platform.dylib        0x0000000196610958 _sigtramp + 64
3   MyAPP                           0x00000001001318cc 0x10009c000 + 612556
4   MyAPP                           0x000000010013797c 0x10009c000 + 637308
5   MyAPP                           0x0000000100135fc4 0x10009c000 + 630724
6   MyAPP                           0x00000001002e408c 0x10009c000 + 2392204
7   MyAPP                           0x00000001001dbf78 0x10009c000 + 1310584
8   libdispatch.dylib               0x00000001964393a8 _dispatch_call_block_and_release + 20
9   libdispatch.dylib               0x0000000196439368 _dispatch_client_callout + 12
10  libdispatch.dylib               0x000000019643d97c _dispatch_main_queue_callback_4CF + 928
11  CoreFoundation                  0x000000018566d69c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
12  CoreFoundation                  0x000000018566b744 __CFRunLoopRun + 1488
13  CoreFoundation                  0x00000001855991f0 CFRunLoopRunSpecific + 392
14  GraphicsServices                0x000000018e7275a0 GSEventRunModal + 164
15  UIKit                           0x0000000189eca780 UIApplicationMain + 1484
16  Shuff                           0x0000000100129474 0x10009c000 + 578676
17  libdyld.dylib                   0x0000000196462a04 start + 0

And here is a sample of the iOS code :

这是 iOS 代码的示例:

var query = PFQuery(className: "_User")
query.whereKey("facebookId", containedIn: ids)

query.findObjectsInBackgroundWithBlock(){
    results, error in
        if var resultsvar = results? {
              self.functionToCall(resultsvar)
         }
 }

and the functionToCall crashes.

并且 functionToCall 崩溃了。

Maybe this can help :

也许这可以帮助:

0 0x00000001001679c8 in specialization of Swift._ArrayBuffer._nonNative.getter : Swift.Optional [inlined] ()

0 0x00000001001679c8 在 Swift._ArrayBuffer._nonNative.getter 的专业化中:Swift.Optional [内联] ()

采纳答案by Devous

Yes !!! The debugger is not working well ! I was able to find the correct lines by doing the following : put a breakpoint at the start of where you think the app crashes, go step by step, remember the lowest line you've gone through. Even if the debugger crashes on another the line, the line you are looking for is probably the lowest one.

是的 !!!调试器工作不正常!通过执行以下操作,我能够找到正确的行:在您认为应用程序崩溃的开始处放置一个断点,逐步执行,记住您已通过的最低行。即使调试器在另一条线上崩溃,您正在寻找的线也可能是最低的。

回答by n13

This is just a guess but I was working on something similar and I think you need to change this code to:

这只是一个猜测,但我正在研究类似的东西,我认为您需要将此代码更改为:

query.findObjectsInBackgroundWithBlock(){
    results?, error? in
        if var resultsvar = results {
              self.functionToCall(resultsvar)
         }
 }

Note that I made both results and error optional. In my case I was providing a block defined in Obj-C, and in Obj-C these objects can legally be == nil. So I think you have to define them as optionals in Swift.

请注意,我将结果和错误都设为可选。在我的例子中,我提供了一个在 Obj-C 中定义的块,而在 Obj-C 中,这些对象在法律上可以是 == nil。所以我认为你必须在 Swift 中将它们定义为可选项。