[英]I received memory warning and my app crashed. Does it kill autorelease objects?
[英]My app crashed when I created autorelease object of DDXMLDocument
我的應用程序沒有崩潰。
DDXMLDocument *d = [[DDXMLDocument alloc] initWithData:abookConnData options:0 error:nil];
books = [d nodesForXPath:@"abooks/abook" error:nil];
我將 DDXMLDocument 的 object 更改為自動釋放,我的應用程序開始崩潰。 但為什么?
DDXMLDocument *d = [[[DDXMLDocument alloc] initWithData:abookConnData options:0 error:nil] autorelease];
books = [d nodesForXPath:@"abooks/abook" error:nil];
我的應用程序在 DDXMLNode 中崩潰。 [DDXMLNode XMLStringWithOptions:]
您沒有提供足夠的代碼來確定,但這幾乎可以肯定是您的 DDXMLDOcument* (d) 在您使用它之前被釋放的情況。
嘗試打開 Zombie 檢測並在 Exception 上放置一個斷點。 通常,這可以引導您找到問題所在的確切代碼行。
調試的另一個技巧是創建 DDXMLDocument 的子類並覆蓋 ALLOC 和 RELEASE 以調用 NSLog() 事件(然后[super alloc]
或[super release]
。)這樣您就可以觀察發生了什么。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.