2011-05-19 570 views
2

我遇到了一些应用程序崩溃问题,我需要一些方向,以便我可以修复它。我有一个主视图和模态视图的应用程序,非常类似于默认的flipside实用程序模板。当我第一次运行应用程序时,一切运行良好,包括模态视图。但是,当我返回到主屏幕然后返回到应用程序时,如果我在前一个会话中激活了模态视图,该应用程序将会崩溃。 (不知道这个术语和作为noob,我打电话给这个应用程序醒来。)如果我没有激活模式视图,只留在前一个会话的主视图中,那么应用程序将恢复运行问题。当应用程序醒来时,EXC_BAD_ACCESS(SIGBUS)和EXC_BAD_ACCESS(SIGSEGV)崩溃

现在,我遇到了问题,进一步跟踪此问题,并会欣赏一些方向。当我在运行xcode时停止应用程序时,调试器停止。仪器告诉我,我已经修复了所有的内存泄漏。这些都是最近的崩溃日志:

Exception Type: EXC_BAD_ACCESS (SIGBUS) 
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000008 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libobjc.A.dylib     0x35248c98 0x35246000 + 11416 
1 CoreLocation     0x35205f78 0x351fe000 + 32632 
2 CoreLocation     0x35206f42 0x351fe000 + 36674 
3 CoreLocation     0x35204a64 0x351fe000 + 27236 
4 CoreLocation     0x3520078a 0x351fe000 + 10122 
5 CoreLocation     0x352018cc 0x351fe000 + 14540 
6 CoreLocation     0x35202d50 0x351fe000 + 19792 
7 CoreFoundation     0x316fd706 0x31691000 + 444166 
8 CoreFoundation     0x31706a90 0x31691000 + 481936 
9 CoreFoundation     0x31708838 0x31691000 + 489528 
10 CoreFoundation     0x31709606 0x31691000 + 493062 
11 CoreFoundation     0x31699ebc 0x31691000 + 36540 
12 CoreFoundation     0x31699dc4 0x31691000 + 36292 
13 GraphicsServices    0x31018418 0x31014000 + 17432 
14 GraphicsServices    0x310184c4 0x31014000 + 17604 
15 UIKit       0x317bfd62 0x31791000 + 191842 
16 UIKit       0x317bd800 0x31791000 + 182272 
17 MyApp       0x000021a4 0x1000 + 4516 
18 MyApp       0x00002158 0x1000 + 4440 

而且

Exception Type: EXC_BAD_ACCESS (SIGSEGV) 
Exception Codes: KERN_INVALID_ADDRESS at 0x709ffd70 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libobjc.A.dylib     0x35248ca4 0x35246000 + 11428 
1 CoreLocation     0x35206f42 0x351fe000 + 36674 
2 CoreLocation     0x35204a64 0x351fe000 + 27236 
3 CoreLocation     0x3520078a 0x351fe000 + 10122 
4 CoreLocation     0x352018cc 0x351fe000 + 14540 
5 CoreLocation     0x35202d50 0x351fe000 + 19792 
6 CoreFoundation     0x316fd706 0x31691000 + 444166 
7 CoreFoundation     0x31706a90 0x31691000 + 481936 
8 CoreFoundation     0x31708838 0x31691000 + 489528 
9 CoreFoundation     0x31709606 0x31691000 + 493062 
10 CoreFoundation     0x31699ebc 0x31691000 + 36540 
11 CoreFoundation     0x31699dc4 0x31691000 + 36292 
12 GraphicsServices    0x31018418 0x31014000 + 17432 
13 GraphicsServices    0x310184c4 0x31014000 + 17604 
14 UIKit       0x317bfd62 0x31791000 + 191842 
15 UIKit       0x317bd800 0x31791000 + 182272 
16 MyApp       0x000021a4 0x1000 + 4516 
17 MyApp       0x00002158 0x1000 + 4440 

所以,从我读过,好像我引用已被删除或以某种方式覆盖的对象?因为我只是在抓秸秆,我不知道我怎么会跟踪下来。

想法?

+0

看看控制台,看看它在哪里崩溃。 – Rayfleck 2011-05-19 22:07:43

+0

我正在尝试,但它没有显示输出,当我重新启动它的人。在通电话。我意识到如果你在xcode中只使用“run”,它就不会像“build and run”那样重启它。我一直在使用键盘快捷键进行构建,并且每次运行时都会通过xcode重新启动它。 D'呃。无论如何,我得到这个:*** - [AddPersonViewController respondsToSelector:]:消息发送到释放实例0x1f8100关闭做一些挖掘。谢谢! – 2011-05-19 23:14:51

+0

这可能是iphone开发中最常见的单一问题。看看[这个链接](http://stackoverflow.com/questions/1211923/how-to-use-nszombie-in-xcode)的一个很好的方式来缩小它。 – Rayfleck 2011-05-19 23:42:44

回答

3

从respondsToSelector调用它可能是你的ModalView,AddPersonViewController我猜,这是保留而不是分配委托属性或不设置为无委托在dealloc和viewDidUnload。在这种情况下,它会尝试将消息发送给您尚未委托的非现有客户。

@property (nonatomic, assign) id <delegate> *delegate; 


self.delegate = nil; in dealloc and viewDidUnload. 
+0

就是这样,mapView.delegate = nil; locationManager.delegate = nil;我一直在努力挣扎,在释放之前我指定了零。 – 2011-05-20 03:13:13

+1

当您通过@property设置变量对象时,会发生以下情况:if(newObject!= _classObject)[_classObject release]; _classObject = [newObject retain]。如果你传递零,_classObject将被释放,[newObject(现在为零)保留]返回分配给_classObject的nil。向nil对象发送消息返回nil。在实例化对象并将它们分配给某个object.property时,还必须小心。如果有分配,你忘记autorelease,你会泄漏内存。 – TheBlack 2011-05-20 10:47:43

相关问题