A strange problem occured when i build my code on iOS5 which was properly working on 4.2.
The problem was with the tableview indexpath. I was trying to get the indexpath value in another method of same class which resulted in a crash in iOS5.
After 2 hours i manage to get it solve by making some changes which i thought to share.
.h file
NSIndexpath *indexPathValue;
@property(nonatomic, copy) NSIndexpath *indexPath;
.m file method cellForRowAtIndexPath
self.indexPathValue = indexPath;
And used the indexPathValue instance wherever required. Hope this help.
The property can have the
retainattribute, not thecopyattribute; it will work fine as long as you remember to use the setter method whenever you wish to assign it:Your current code copies the pointer without attempting to retain it in any way (you don’t use the synthesized setter method) and it will cause a crash some time later.