iphone - 应用程序崩溃,但仅在为 Ad-Hoc 发行版构建时

标签 iphone cocoa-touch memory uikit crash

我的问题是这个。我有一个在 Debug模式下构建和运行良好的应用程序,没有崩溃、内存错误等。只要我进行临时构建并尝试在设备上运行它,主线程就会在某个点崩溃,没有明显的原因......我设法从设备日志中获得的堆栈跟踪是......

0   libSystem.B.dylib               0x30d7c2d4 __kill + 8
1   libSystem.B.dylib               0x30d7c2c4 kill + 4
2   libSystem.B.dylib               0x30d7c2b6 raise + 10
3   libSystem.B.dylib               0x30d90d72 abort + 50
4   libstdc++.6.dylib               0x34981a20 __gnu_cxx::__verbose_terminate_handler() + 376
5   libobjc.A.dylib                 0x34a83594 _objc_terminate + 104
6   libstdc++.6.dylib               0x3497fdf2 __cxxabiv1::__terminate(void (*)()) + 46
7   libstdc++.6.dylib               0x3497fe46 std::terminate() + 10
8   libstdc++.6.dylib               0x3497ff16 __cxa_throw + 78
9   libobjc.A.dylib                 0x34a824c4 objc_exception_throw + 64
10  CoreFoundation                  0x3587a7c2 +[NSException raise:format:arguments:] + 62
11  CoreFoundation                  0x3587a7fc +[NSException raise:format:] + 28
12  QuartzCore                      0x31071222 CALayerSetPosition(CALayer*, CA::Vec2<double> const&, bool) + 134
13  QuartzCore                      0x31071190 -[CALayer setPosition:] + 32
14  UIKit                           0x341e4378 -[UIView(Geometry) setCenter:] + 16
15  MyApp                           0x00012b2c 0x1000 + 72492
16  MyApp                           0x0001276a 0x1000 + 71530
17  UIKit                           0x341e3270 -[UIViewController view] + 104
18  UIKit                           0x341efd04 -[UIViewController contentScrollView] + 16
19  UIKit                           0x341efb74 -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:] + 24
20  UIKit                           0x341efa72 -[UINavigationController _layoutViewController:] + 18
21  UIKit                           0x341ef4cc -[UINavigationController _startTransition:fromViewController:toViewController:] + 248
22  UIKit                           0x341ef358 -[UINavigationController _startDeferredTransitionIfNeeded] + 176
23  UIKit                           0x341e30be -[UINavigationController pushViewController:transition:forceImmediate:] + 634
24  UIKit                           0x341e2e34 -[UINavigationController pushViewController:animated:] + 28
25  MyApp                           0x00004f80 0x1000 + 16256
26  UIKit                           0x3420b834 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 656
27  UIKit                           0x342cb60c -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 124
28  Foundation                      0x31181df6 __NSFireDelayedPerform + 362
29  CoreFoundation                  0x3583109c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
30  CoreFoundation                  0x35830b54 __CFRunLoopDoTimer + 844
31  CoreFoundation                  0x358021ae __CFRunLoopRun + 1082
32  CoreFoundation                  0x35801c80 CFRunLoopRunSpecific + 224
33  CoreFoundation                  0x35801b88 CFRunLoopRunInMode + 52
34  GraphicsServices                0x320c84a4 GSEventRunModal + 108
35  GraphicsServices                0x320c8550 GSEventRun + 56
36  UIKit                           0x341dc322 -[UIApplication _run] + 406
37  UIKit                           0x341d9e8c UIApplicationMain + 664

另一个真正奇怪的事情是,如果您关闭应用程序并在后台停止运行(崩溃后)然后重新启动它,它几乎立即退出...
<Warning>: Application 'MyApp' exited abnormally with signal 11: Segmentation fault

我相信这是一个内存访问错误(未初始化的内存访问)。我没有用指针或任何东西做任何疯狂的事情,所以我只能假设这是 CF 库的问题......

任何想法或帮助将不胜感激:)

最佳答案

如果不知道更多,很难确切地说出答案是什么,但我的第一个猜测是您为 UIView 提供了一些无效值。的center属性(property)。

缺少两条可以帮助您/我找到答案的信息。

首先,需要对堆栈跟踪中的这些行进行符号化:

15  MyApp                           0x00012b2c 0x1000 + 72492
16  MyApp                           0x0001276a 0x1000 + 71530

了解这两行中发生的事情将有助于您追踪它,并且了解抛出的异常(从堆栈跟踪中的第 11 行开始)包含的内容将有助于进一步。您可以通过在 Xcode 的 Organizer 中查看设备的控制台输出来获取此信息。

如果您拥有在为 AdHoc 分发构建应用程序时创建的 dSYM 文件,则可以符号化崩溃报告。将崩溃报告拖入 Xcode 的 Organizer 窗口将尝试自动对其进行符号化。如果这不起作用,您可以尝试直接使用 symbolicatecrash 脚本。它隐藏在这样的路径中:

/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash

关于iphone - 应用程序崩溃,但仅在为 Ad-Hoc 发行版构建时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4900012/

相关文章:

ios - 如何将 subview 添加到当前导航 Controller ?

objective-c - UILabel 自动换行/字符换行

objective-c - CALayer addSublayer 增加保留计数?

c# - .net 应用程序的非托管堆大小

.net - 可以从不同的应用程序轻松读取我的可变数据吗?

Java 32 位 Xmx 与 Java 64 位 Xmx

ios - 您是否在同一个 prepareForSegue 方法中为一个 View Controller 的所有 segues 实现了行为?

iPhone - block 枚举

使用 OpenGL ES 2.0 的 iOS 360 视频

ios - ios通过JSON循环?