开发者

Object in NSMutableArray crushed in memory

开发者 https://www.devze.com 2022-12-28 13:55 出处:网络
I have some big problem with an NSMutableArray I\'m filling with objects in a database. I\'m using [appDelegate.myArray addObject:myObject], then somehow the object gets crushed in the m开发者_如何学运

I have some big problem with an NSMutableArray I'm filling with objects in a database. I'm using [appDelegate.myArray addObject:myObject], then somehow the object gets crushed in the m开发者_如何学运维emory, I don't know why, I didn't release anything.

How that can happen?


How did you create the array? Is it perhaps being autoreleased when you don't want it to be? (i.e. did you create with with +alloc and -init or with +array ?

And yes, what on earth does "crushed" mean in this sense? :)


Sorry, the problem was actually that in my object initialisation method I did something like :

name = @"";
address = @""; ...

instead of :

self.name = @"";
self.address = @""; ...

Be careful to not waste your time with that kind of mistake...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号