2010-07-21 61 views
1

我有一個棘手的問題(對我來說很難,因爲我是一個新手)。我有一個桌面視圖應用程序,我正在努力。它從一個表開始,然後導航到一個視圖控制器。在這個視圖控制器中,我使用了一些示例代碼,這些代碼被添加到一個按鈕中,該按鈕將添加一個聯繫人到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

回答

0

通常崩潰意味着你有某種記憶問題或調用一個未定義功能(發送未被接收應答消息)。

正在嘗試從指針讀取已釋放的對象嗎? 您是否試圖將消息發送給未回覆的對象?

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

首先,打開控制檯(SHIFT +命令R),看看是否有一個消息或堆棧跟蹤你的應用崩潰。如果沒有消息,請運行調試器(Shift + Command Y)並查看崩潰停止的位置。

最後,如果你看到的XCode的狀態欄,它會告訴你一點點關於崩潰(這是發送有關崩潰的消息,信息可能是EXEC_BAD_ADDRESS或一些其他的事情。

可悲,沒有你的代碼或任何這些信息,這些都是我可以幫助你的,我建議你不僅要複製和粘貼,還要真正理解代碼應該做什麼,並且學習如何調試你的代碼

對於優秀的資源,我會推薦Itunes U Standford Iphone開發課程和/或閱讀一本關於它的好書(我讀了Head First Iphone書,我很喜歡這個系列,但並不喜歡這個)。