iphone - iOS 应用程序在启动时崩溃
<p><p>我的应用程序的最新版本已开始在某些用户启动时崩溃。 iTunes 中只有 1 个崩溃报告,如下所示。我无法在任何设备上重现。</p>
<p>两个版本的变化是</p>
<ol>
<li>集成了两个第三方库(iNotify、openUDID)</li>
<li>从 GCC 编译器切换到 Apple LLVM 3.1 编译器(新库需要 arc 支持)</li>
<li>在启用 arc 的情况下编译新库的代码,在项目的其余部分禁用 arc。</li>
</ol>
<p>我在 iNotify 的 appdelegate 中的 didFinishLaunchingWithOptions 中添加了 1 行。从堆栈跟踪到我认为它不会在那里崩溃。</p>
<p>有点不知所措。任何帮助,将不胜感激。谢谢!</p>
<pre><code>Hardware Model: iPhone4,1
Process: MyAPP
Path: /var/mobile/Applications/228BBF42-A374-4773-8C18-EFA47CE98C02/MyAPP.app/MyAPP
Identifier: MyAPP
Version: ??? (???)
Code Type: ARM (Native)
Parent Process:launchd
Date/Time: 2012-05-03 19:50:07.917 -0500
OS Version: iPhone OS 5.1 (9B179)
Report Version:104
Exception Type:EXC_CRASH (SIGABRT)
Exception Codes: 0x00000000, 0x00000000
Crashed Thread:0
Last Exception Backtrace:
0 CoreFoundation 0x3729e88f __exceptionPreprocess + 163
1 libobjc.A.dylib 0x357a4259 objc_exception_throw + 33
2 CoreFoundation 0x372a1a9b - + 175
3 CoreFoundation 0x372a0915 ___forwarding___ + 301
4 CoreFoundation 0x371fb650 _CF_forwarding_prep_0 + 48
5 UIKit 0x33aa9f93 - + 855
6 UIKit 0x3395fc53 - + 471
7 UIKit 0x3396557d - + 53
8 QuartzCore 0x341fbc2f CA::Layer::run_animation_callbacks(void*) + 203
9 libdispatch.dylib 0x344f6ee7 _dispatch_main_queue_callback_4CF$VARIANT$mp + 195
10CoreFoundation 0x372712ad __CFRunLoopRun + 1269
11CoreFoundation 0x371f44a5 CFRunLoopRunSpecific + 301
12CoreFoundation 0x371f436d CFRunLoopRunInMode + 105
13GraphicsServices 0x32101439 GSEventRunModal + 137
14UIKit 0x33978e7d UIApplicationMain + 1081
15MyAPP 0x00002bfb main (main.m:14)
16MyAPP 0x00002bb4 0x00002bb4
Thread 0 name:Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x3571d32c __pthread_kill + 8
1 libsystem_c.dylib 0x3186b208 pthread_kill + 48
2 libsystem_c.dylib 0x31864298 abort + 88
3 libc++abi.dylib 0x34e70f64 abort_message + 40
4 libc++abi.dylib 0x34e6e346 _ZL17default_terminatev + 18
5 libobjc.A.dylib 0x357a4350 _objc_terminate + 140
6 libc++abi.dylib 0x34e6e3be _ZL19safe_handler_callerPFvvE + 70
7 libc++abi.dylib 0x34e6e44a std::terminate() + 14
8 libc++abi.dylib 0x34e6f81e __cxa_rethrow + 82
9 libobjc.A.dylib 0x357a42a2 objc_exception_rethrow + 6
10CoreFoundation 0x371f4506 CFRunLoopRunSpecific + 398
11CoreFoundation 0x371f4366 CFRunLoopRunInMode + 98
12GraphicsServices 0x32101432 GSEventRunModal + 130
13UIKit 0x33978e76 UIApplicationMain + 1074
14MyAPP 0x00002bf4 main (main.m:14)
15MyAPP 0x00002bac 0x00002bac
Thread 1 name:Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x3570d3a8 kevent + 24
1 libdispatch.dylib 0x344f7f04 _dispatch_mgr_invoke + 708
2 libdispatch.dylib 0x344f7c22 _dispatch_mgr_thread + 30
Thread 2 name:WebThread
Thread 2:
0 libsystem_kernel.dylib 0x3570d004 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3570d1fa mach_msg + 50
2 CoreFoundation 0x372723ec __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x37271124 __CFRunLoopRun + 876
4 CoreFoundation 0x371f449e CFRunLoopRunSpecific + 294
5 CoreFoundation 0x371f4366 CFRunLoopRunInMode + 98
6 WebCore 0x32eb40f0 _ZL12RunWebThreadPv + 396
7 libsystem_c.dylib 0x3182c72e _pthread_start + 314
8 libsystem_c.dylib 0x3182c5e8 thread_start + 0
Thread 3:
0 libsystem_kernel.dylib 0x3571dcd4 __workq_kernreturn + 8
1 libsystem_c.dylib 0x31826f36 _pthread_wqthread + 610
2 libsystem_c.dylib 0x31826cc8 start_wqthread + 0
Thread 4 name:com.apple.CFSocket.private
Thread 4:
0 libsystem_kernel.dylib 0x3571d570 __select + 20
1 CoreFoundation 0x3727663a __CFSocketManager + 726
2 libsystem_c.dylib 0x3182c72e _pthread_start + 314
3 libsystem_c.dylib 0x3182c5e8 thread_start + 0
Thread 5:
0 libsystem_kernel.dylib 0x3571dcd4 __workq_kernreturn + 8
1 libsystem_c.dylib 0x31826f36 _pthread_wqthread + 610
2 libsystem_c.dylib 0x31826cc8 start_wqthread + 0
</code></pre>
<p>一些额外的代码。</p>
<p>在appdelegate中有一个alertview定义如下:</p>
<pre><code>#import <UIKit/UIKit.h>
@class MyAPPViewController;
@interface MyAPPAppDelegate : NSObject <UIApplicationDelegate> {
UIViewController *rvc;
UIAlertView *m_cAlertControl;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
-(BOOL)shouldNag;
-(void)shouldEnableUI:(BOOL)pIsEnable;
-(void)updateRunCount;
@end
</code></pre>
<p>以及在应用委托(delegate)中实现的方法如下:</p>
<pre><code>-(void)shouldEnableUI:(BOOL)pIsEnable
{
if(NO == pIsEnable)
{
if (nil == m_cAlertControl) {
m_cAlertControl = [ init];
}
m_cAlertControl.backgroundColor = ;
m_cAlertControl.opaque = NO;
;
;
}
else {
if (nil != m_cAlertControl) {
;
}
}
</code></pre>
<p>}</p>
<p> ViewController 对方法的调用如下:</p>
<p>;</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>在看到崩溃日志问题时,似乎已在 <code>UIAlertViewDelegate</code> 发布后对其进行了调用。</p>
<p>您需要在使用警报的 Controller 中释放它 -</p>
<pre><code>-(void)dealloc {
self.alertView.delegate = nil; //setting delegate to nil
self.alertView = nil; //if you have defined alert as property
//other release statements of your controller
;
}
</code></pre>
<p>如果您想要一些其他信息,您可以添加您应用的一些代码,或者您的应用不是这样。</p>
<p>编辑 1 - </p>
<pre><code>-(void)dealloc {
m_cAlertControl.delegate = nil; //setting delegate to nil
;
//other release statements of your controller
;
}
</code></pre></p>
<p style="font-size: 20px;">关于iphone - iOS 应用程序在启动时崩溃,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/10605369/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/10605369/
</a>
</p>
页:
[1]