gpt4 book ai didi

ios - 为 Debug-iphoneos 构建时如何调试断言

转载 作者:行者123 更新时间:2023-11-30 13:30:46 26 4
gpt4 key购买 nike

我正在为 iOS 开发一个 SDK,我在代码中添加了一些 assert() 来帮助我捕获错误。使用模拟器时它工作得很好,但如果我在设备上构建我的应用程序(调试-iphoneos),将其从我的 Mac 上拔下并留作测试,我从断言失败中获得的崩溃日志将无法理解。来自基本 nil 断言失败的真实示例:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x00000000e7ffdefe
Triggered by Thread: 0

Filtered syslog:
None found

Global Trace Buffer (reverse chronological seconds):
10.153264 CFNetwork 0x0000000021bb897d TCP Conn 0x14dbd8c0 complete. fd: 9, err: 0
10.154690 CFNetwork 0x0000000021bb9a7f TCP Conn 0x14dbd8c0 event 1. err: 0
10.288093 CFNetwork 0x0000000021bb9afd TCP Conn 0x14dbd8c0 started
10.293561 CFNetwork 0x0000000021bff26f Creating default cookie storage with default identifier
10.293562 CFNetwork 0x0000000021bff24b Faulting in CFHTTPCookieStorage singleton
10.293562 CFNetwork 0x0000000021c418f7 Faulting in NSHTTPCookieStorage singleton
10.514965 CFNetwork 0x0000000021bb897d TCP Conn 0x14d88140 complete. fd: 4, err: 0
10.514965 CFNetwork 0x0000000021bb9a7f TCP Conn 0x14d88140 event 1. err: 0
10.789507 CFNetwork 0x0000000021bb9afd TCP Conn 0x14d88140 started



Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libswiftCore.dylib 0x00509e10 0x3af000 + 1420816
1 MyFramework 0x002ddfec 0x24f000 + 585708

我有机会从崩溃日志中获取更多信息吗?我试过atos -arch armv7 -o MyApp.app/MyApp 0x24f000没有任何成功(返回0x24f000)

最佳答案

通过这篇文章解决了Atos does not symbolicate system frameworks/libraries properly

这里我必须从 .app 中提取我的框架并执行

xcrun atos -arch armv7 -o  MyFramework.framework/MyFramework -l 0x24f000 0x002ddfec

(注意内存地址的相反顺序)

关于ios - 为 Debug-iphoneos 构建时如何调试断言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36597515/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com