I have EXC_BAD_ACCESS at this line:
self.accountControl.baseInfo = base
When I enabled NSZombies I get this error:
-[CFString release]: message sent to deallocated instance 0x1478cbc0
I found out that my problem is here:
override func viewDidLoad() {
super.viewDidLoad()
if baseInfo == nil {
baseInfo = StorageManager.sharedInstance.getBaseInfo()
reloadBaseInfo(false)
}
Method getBaseInfo()
in StorageManager:
func getBaseInfo() -> BaseInfo? {
if let baseInfoCD = getBaseInfoCD() {
var baseInfo = BaseInfo()
baseInfo.update(baseInfoCD)
return baseInfo
}
return nil
}
func getBaseInfoCD() -> BaseInfoCD? {
let fetchRequest = NSFetchRequest(entityName: "BaseInfoCD")
var error: NSError?
if let fetchResults = managedObjectContext.executeFetchRequest(fetchRequest, error: &error) as? [BaseInfoCD] {
if fetchResults.count > 0 {
return fetchResults.last!
}
}
return nil
}
I think that problem is with Core Data and it release object but I don't know what I am doing wrong. Here is screen from Zombie Instruments:
What I am doing wrong? How can I fix it? Thanks
It's really weird but I fix this by renaming property. My BaseInfo class has property:
var newTicket: String = ""
and BaseInfoCD has:
@NSManaged var newTicket: String?
and there was a problem. I guess it's because it starts with new. When I rename it to ticketNew it works fine.