[CFString release]:消息发送到释放的实例 [英] [CFString release]: message sent to deallocated instance

查看:1141
本文介绍了[CFString release]:消息发送到释放的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力与一个奇怪的问题两天了。我经历了每一个相关的问题,但没有解决这个问题。我正在处理Xcode5。我使用的是ARC和CoreData。

I've been struggling with a strange problem for two days now. I went through every related question on SO but none solved the issue. I'm working on Xcode5. I'm using ARC and CoreData.

在iOS7(模拟器)上:

On iOS7 (simulator):

`[CFString release]: message sent to deallocated instance`

Thread 1, Queue : com.apple.main-thread
0   0x03c7d3ba in __kill ()
1   0x03c7c4b8 in kill$UNIX2003 ()
2   0x0347a921 in ___forwarding___ ()
3   0x0347a4ee in _CF_forwarding_prep_0 ()
4   0x02b7b002 in -[NSConcreteAttributedString dealloc] ()
5   0x02f66692 in objc_object::sidetable_release(bool) ()
6   0x02f65e81 in objc_release ()
7   0x02f66ce7 in (anonymous namespace)::AutoreleasePoolPage::pop(void*) ()
8   0x00739bc4 in CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) ()
9   0x0345253e in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
10  0x0345248f in __CFRunLoopDoObservers ()
11  0x034303b4 in __CFRunLoopRun ()
12  0x0342fb33 in CFRunLoopRunSpecific ()
13  0x0342f94b in CFRunLoopRunInMode ()
14  0x04bd19d7 in GSEventRunModal ()
15  0x04bd17fe in GSEventRun ()
16  0x0196794b in UIApplicationMain ()
17  0x0000262d in main

Zombies Instruments指向我设置单元格文本标签的第二行: / p>

The Zombies Instruments point to the second line where I set the cell's text labels:

cell.txtLabel.text = _reservationModule.newReservationText;
cell.subtitleTxtLabel.text = _reservationModule.newReservationSubtitle;

_reservationModule 是一个核心数据实体,字符串属性。它在视图控制器中定义为 @property(nonatomic,strong)ReservationModule * reservationModule;

_reservationModule is a Core Data entity featuring the string properties. It's defined in the view controller as @property (nonatomic, strong) ReservationModule *reservationModule;

僵尸历史:

Event Type  ∆ RefCt RefCt   Timestamp   Responsible Library Responsible Caller
Malloc/Retain/Release (4)   01:01.114.922   CoreData    _prepareResultsFromResultSet
0  Malloc   +1  1   01:01.114.922   CoreData    _prepareResultsFromResultSet
1  Retain   +1  2   01:01.116.184   CoreData    -[_CDSnapshot mutableCopy]
2  Release  -1  1   01:01.318.588   MyApp       -[ReservationModuleChoice2ViewController configureSubtitleImageTableViewCell:atIndexPath:]
3  Release  -1  0   01:05.004.359   CoreData    -[_CDSnapshot dealloc]
4  Zombie       -1  01:07.441.465   CoreData    -[_CDSnapshot dealloc]

他们从来没有发生过Xcode 4.6.x。
任何帮助都非常感谢!

They've never occurred on Xcode 4.6.x though. Any help is highly appreciated!

谢谢!

推荐答案

p>

我知道它不允许命名变量/属性以 new 启用ARC。这显然导致过度释放,从而产生错误...

I oversaw that it isn't allowed to name variables/properties starting with new with ARC enabled. This obviously resulted in an over release thus generating the error...

从Apple文档: https://developer.apple.com/library/ios/releasenotes/objectivec/rn-transitioningtoarc/introduction/introduction.html



From Apple documentation: https://developer.apple.com/library/ios/releasenotes/objectivec/rn-transitioningtoarc/introduction/introduction.html


为了允许与手动保留释放代码互操作,ARC对方法命名强制使用
约束:

To allow interoperation with manual retain-release code, ARC imposes a constraint on method naming:

您不能给访问者以新开头的名称。这反过来
意味着你不能,例如,声明一个名称
以新开始的属性,除非你指定一个不同的getter

You cannot give an accessor a name that begins with new. This in turn means that you can’t, for example, declare a property whose name begins with new unless you specify a different getter

这篇关于[CFString release]:消息发送到释放的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆