0

我收到此错误消息:

消息 [CFString release] 发送到 0x 处的已释放对象............

我怎么知道是哪个字符串导致了这个问题?我可以弄清楚CFString它使用的是哪个调试器吗?

4

3 回答 3

3

如果您使用的是 XCode 4,请使用 Zombie 工具(构建和配置文件)。出现此消息时,您可以按箭头以获取保留和释放字符串的所有位置的列表。

于 2011-04-25T04:40:09.943 回答
1

请参阅http://www.cocoadev.com/index.pl?NSZombieEnabled放置一个断点并回溯堆栈以找到它发生的发布语句。

于 2011-04-25T04:41:10.163 回答
-1

首先,您可以尝试查找您的代码中的 alloc/dealloc 函数,然后计算它。
它一直是“ count alloc == count dealloc ”。
第二步,找一些构造:

NSString *myString = [NSString stringWith...]; // Auto alloc/init with content
[myString release]; // Release before use
NSLog(@"%@", myString); // Use after release

或尝试调试NSLog(%"retain count :%d", [myString retainCount]);

于 2011-04-25T04:43:23.247 回答