I have narrowed down this error (which crashes my app):
-[NSConcreteMutableData release]: message sent to deallocated instance 0x6eaed40
to the following code:
emailData = [kmlDoc dataUsingEncoding:NSUTF8StringEncoding];
But, I cannot figure out why this error is being caused? That line is just setting a very large string to an NSData object. I am releasing emailData in the dealloc method.
What is going wrong here?
You need to take ownership of the object:
Or using retain/copy properties:
Remember that you explicitly have to take ownership for returned objects from methods that contain neither
new,alloc,retainorcopyin their name as they return autoreleased instances.See the Memory Management Guide for more.