2012-04-01 79 views
0

我已經得到了來自蘋果它談論崩潰我的應用程序崩潰報告由於一些nspathstore2泄漏,現在我發現很難發現代碼中的錯誤看完後,我在這裏報告iphone dev如何從崩潰報告中找到nspathstore2內存泄漏?

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libobjc.A.dylib     0x31071f7e objc_msgSend + 22 
1 Foundation      0x35ba2210 -[NSPathStore2 stringByAppendingPathComponent:] + 84 
2 Photobook      0x000131d0 0x1000 + 74192 
3 Photobook      0x0001333c 0x1000 + 74556 
4 Photobook      0x000138a2 0x1000 + 75938 
5 Photobook      0x0001200c 0x1000 + 69644 
6 Photobook      0x000113ac 0x1000 + 66476 
7 UIKit       0x36fc30b6 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 142 
8 CoreFoundation     0x36ca51f4 -[NSObject performSelector:withObject:] + 36 
9 QuartzCore      0x36481a9e -[CALayer layoutSublayers] + 210 
10 QuartzCore      0x364816b6 CA::Layer::layout_if_needed(CA::Transaction*) + 210 
11 QuartzCore      0x3648583c CA::Context::commit_transaction(CA::Transaction*) + 220 
12 QuartzCore      0x36485578 CA::Transaction::commit() + 308 
13 QuartzCore      0x3647d4b2 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 50 
14 CoreFoundation     0x36d1ab14 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 12 
15 CoreFoundation     0x36d18d50 __CFRunLoopDoObservers + 252 
16 CoreFoundation     0x36d190aa __CFRunLoopRun + 754 
17 CoreFoundation     0x36c9c49e CFRunLoopRunSpecific + 294 
18 CoreFoundation     0x36c9c366 CFRunLoopRunInMode + 98 
19 GraphicsServices    0x30d7e432 GSEventRunModal + 130 
20 UIKit       0x36fede76 UIApplicationMain + 1074 
21 Photobook      0x0000229c 0x1000 + 4764 
22 Photobook      0x00002254 0x1000 + 4692 

現在我是假設,這種「1基金會0x35ba2210 - [NSPathStore2 stringByAppendingPathComponent:] + 84」 suugests認爲,墜機是在線路84某處項目,所以我試圖找到這一點,但沒有stringByAppendingPathComponent:在線路使用84在項目中的任何地方,所以我很困惑,如何在項目中找到泄漏,任何人都可以指導如何找到這個,thanx和方面。薩阿德

回答

1

問題:

- [NSPathStore2長度]:發送到實例0x80cea00

無法識別選擇當與NSPathStore2通知你的應用程序崩潰是否其包含像它上面的任何方法包含「長度」,然後去我的解決方案低於其工作罰款對我來說,我希望它也適用於你:)

解決方案:上述錯誤消息意味着它有一些問題,你的「PATH」對象variable.I與您下方給出的例子解釋: 讓我們考慮你有你的.m文件定義了下面的代碼任何方法,其中其需要界定。凡「DBPATH」是的NSString類變量,在.h文件中定義。現在你完整路徑將存儲在「DBPATH」變量作爲例子descripted以下。現在,當你打算使用這種「DBPATH」在.m文件的任何其他方法變量它,然後它獲取故障上述消息「- [NSPathStore2長]:無法識別的選擇發送到實例0x80cea00」因爲你也沒有吃 「頁頭」 或 「保留」 的 「DBPATH」。所以這個問題的解決辦法是請alloc保留dbpath」變量在下面給出的例子中。 這是我的回答,當我受到這個折磨及其對我的工作的時候。所有最好的TO YOU :) 的NSArray *路徑= NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString * path = [paths objectAtIndex:0]; dbpath = [path stringByAppendingPathComponent:@「mydb.sqlite」];