Objective-C iPhone App EXC_BREAKPOINT (SIGTRAP)

2019-06-17 12:19发布

I recently released an application about a month ago, it was thoroughly tested by myself, my partner, and beta testers. Recently a user contacted me about the app not even being able to open (crashes after start up screen), they have the correct OS and they tried reinstalling.

I asked for the crash log and they sent me it...

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x00000001, 0xe7ffdefe
Crashed Thread:  0

Thread 0 Crashed:
0   dyld                           0x2fe01060 0x2fe00000 + 4192
1   dyld                           0x2fe088d4 0x2fe00000 + 35028
2   dyld                           0x2fe0196c 0x2fe00000 + 6508
3   dyld                           0x2fe01048 0x2fe00000 + 4168

Thread 0 crashed with ARM Thread State:
    r0: 0x2fe23ca0    r1: 0x00000000      r2: 0x2fe23ca0      r3: 0x00000000
    r4: 0x2ffff4e0    r5: 0x2ffff4bc      r6: 0x2fe005c0      r7: 0x2ffffb00
    r8: 0x00000004    r9: 0x2fe57cf0     r10: 0x2fe236c8     r11: 0x00000009
    ip: 0x0000018d    sp: 0x2ffff5b8      lr: 0x2fe088dc      pc: 0x2fe01060
  cpsr: 0x00000010

Binary Images:
0x2fe00000 - 0x2fe22fff  dyld ??? (???) <f6a50d5f57a676b54276d0ecef46d5f0> /usr/lib/dyld

I can't seem to find a problem within my app, what type of problems cause EXC_BREAKPOINT (SIGTRAP)? I'm assuming the error is within my AppDelegate since it crashes right after the start up screen.

4条回答
霸刀☆藐视天下
2楼-- · 2019-06-17 12:26

There's a general rule of thumb with crash logs: If the backtrace is useless, look at the console log output.

In this case, what's probably happening is that you're using things not present in an older OS version. When dyld (the dynamic loader) tries to resolve symbols at load time, it fails to find some of them, and either the symbol or library isn't being weak linked. The console log should say which symbol/library failed to load.

In the common case, you can just change the framework from "Required" to "Weak".

查看更多
相关推荐>>
3楼-- · 2019-06-17 12:29

I've gotten this error too and fixed it. This person is running OS3 most likely and you are using a code block from OS4 you need to set a weak link on the library so that it can properly load. in your build settings for LLVM -weak_library /usr/lib/libSystem.B.dylib

also discussed here iOS 4 app crashes at startup on iOS 3.1.3: Symbol not found: __NSConcreteStackBlock

查看更多
劳资没心,怎么记你
4楼-- · 2019-06-17 12:34

Try these steps from Apple's tech note on reading crash files. It explains how to turn the hex code into symbols (class names, method names, variable names etc) from your app.

Signal.h contains a list of the errors like SIGTRAP which is defined as:

#define SIGTRAP 5   /* trace trap (not reset when caught) */
查看更多
爷的心禁止访问
5楼-- · 2019-06-17 12:51

This is a pretty strange stack trace. It's crashing in dyld (the dynamic library loader). That suggests that it's having trouble loading a dynamic library or Framework, which means it's in the loading of system code (since you can't have a 3rdparty dynamic library on a standard iphone). Notice how in the Binary Images section, your code doesn't even seem to be loaded yet (or was the rest of the dump truncated)? Do you do any manual loading of dynamic libraries (dlopen() or the like)? Even if you were, you'd expect main() to be on the stack if your program had actually loaded....

When you say they've tried reinstalling, I assume you mean your app? Does that mean they deleted your app and then reinstalled it, or something else? The most likely cause that comes to mind is corruption of the bundle. But you'd think that deleting and reinstalling would fix that up. More aggressive would be delete, reboot, then reinstall.

My next question would be whether this is a jailbroken iPhone. I'd ask the user to reboot the iPhone if they haven't already. I'd even be tempted to ask them to do a restore of the OS, but that's always an awkward thing to ask a customer to do.

查看更多
登录 后发表回答