I have this function return [remoteObject objectForKey:key]; which should return an object that is in my dictionary.
When I am starting the Iphone simulator everything is fine and it returns the right object.
But when I am starting the same application an my device my application crashes and it says SIGABRT
and
2011-12-05 10:25:17.601 iPhoneXMPP[242:1a1f] -[CALayer objectForKey:]:
unrecognized selector sent to instance 0x4f3d40 2011-12-05
10:25:17.602 iPhoneXMPP[242:1a1f] * Terminating app due to uncaught
exception ‘NSInvalidArgumentException’, reason: ‘-[CALayer
objectForKey:]: unrecognized selector sent to instance 0x4f3d40’
My key is an Id (17) and it is also in my dictionary.
Does anybody of you knows why this happens only on my device?
It means that your
remoteObjectobject is being deallocated somewhere. Usually autoreleases happen faster on the device because it has less memory than the simulator that’s why on the simulator your object is still there when you are trying to call it’s method. Make sure you callretainon your object when you created it andreleasewhen you are done with it.