iPhone应用程序在导航过程中崩溃

问题描述:

我有一个棘手的问题(对我来说很难,因为我是一个新手)。我有一个桌面视图应用程序,我正在努力。它从一个表开始,然后导航到一个视图控制器。在这个视图控制器中,我使用了一些示例代码,这些代码被添加到一个按钮中,该按钮将添加一个联系人到iPhone地址簿。iPhone应用程序在导航过程中崩溃

我的问题是,当用户导航回到数据表,应用程序崩溃。有没有人可以提供的建议?或者,也许有人可以向我发送代码进行审查?

更新*

这是来自控制台的信息。

[Session started at 2010-07-20 22:51:46 -0500.] 
2010-07-20 22:51:49.621 Infinite Possibilities[5882:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSPlaceholderString initWithString:]: nil argument' 
*** Call stack at first throw: 
(
0 CoreFoundation      0x025ff919 __exceptionPreprocess + 185 
1 libobjc.A.dylib      0x0274d5de objc_exception_throw + 47 
2 CoreFoundation      0x025b8078 +[NSException raise:format:arguments:] + 136 
3 CoreFoundation      0x025b7fea +[NSException raise:format:] + 58 
4 Foundation       0x0006869c -[NSPlaceholderString initWithString:] + 105 
5 Infinite Possibilities    0x00003b90 -[RootViewController tableView:didSelectRowAtIndexPath:] + 3405 
6 UIKit        0x0034c718 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1140 
7 UIKit        0x00342ffe -[UITableView _userSelectRowAtIndexPath:] + 219 
8 Foundation       0x00059cea __NSFireDelayedPerform + 441 
9 CoreFoundation      0x025e0d43 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 19 
10 CoreFoundation      0x025e2384 __CFRunLoopDoTimer + 1364 
11 CoreFoundation      0x0253ed09 __CFRunLoopRun + 1817 
12 CoreFoundation      0x0253e280 CFRunLoopRunSpecific + 208 
13 CoreFoundation      0x0253e1a1 CFRunLoopRunInMode + 97 
14 GraphicsServices     0x02e642c8 GSEventRunModal + 217 
15 GraphicsServices     0x02e6438d GSEventRun + 115 
16 UIKit        0x002e8b58 UIApplicationMain + 1160 
17 Infinite Possibilities    0x00002834 main + 102 
18 Infinite Possibilities    0x000027c5 start + 53 
) 
terminate called after throwing an instance of 'NSException' 
+0

它是什么样的崩溃?应该说在控制台。 – AtomRiot 2010-07-21 03:28:00

+1

调试应用程序并提供崩溃日志,以便我们可以看到导致崩溃的原因。而且,提供有问题的代码会很有用。 – raidfive 2010-07-21 03:28:36

+1

我猜想有些对象在它使用之前就被释放了,可能检查你的视图控制器,你可能已经释放了两次对象。 – Splendid 2012-03-07 17:52:29

通常崩溃意味着你有某种记忆问题或调用一个未定义功能(发送未被接收应答消息)。

正在尝试从指针读取已释放的对象吗? 您是否试图将消息发送给未回复的对象?

好消息是,你有很多很好的工具来找出它到底是什么:

首先,打开控制台(SHIFT +命令R),看看是否有一个消息或堆栈跟踪你的应用崩溃。如果没有消息,请运行调试器(Shift + Command Y)并查看崩溃停止的位置。

最后,如果你看到的XCode的状态栏,它会告诉你一点点关于崩溃(这是发送有关崩溃的消息,信息可能是EXEC_BAD_ADDRESS或一些其他的事情。

可悲,没有你的代码或任何这些信息,这些都是我可以帮助你的,我建议你不仅要复制和粘贴,还要真正理解代码应该做什么,并且学习如何调试你的代码

对于优秀的资源,我会推荐Itunes U Standford Iphone开发课程和/或阅读一本关于它的好书(我读了Head First Iphone书,我很喜欢这个系列,但并不喜欢这个)。