Just a quick XCode/Objective-C pointer, for those of you who happen to come across the familiar console error EXC_BAD_ACCESS. I will be working on an overview tutorial regarding Memory Management, but for now, this quick set of notes would help you generally understand memory issues you may come across and feel stumped!
- You are only responsible for releasing an object from memory when:
- you directly have allocated (ALLOC), copy or retain that object, you may proceed with release ing or autorelease ing it. Otherwise, it’s not your duty to release.
- If you need to store a returned object in an instance object you have (i.e self.varName), you must Retain or Copy it before releasing it. ( I will discuss this more in a future blog post).
- If you instantiate an object using a convenience method i.e :
NSString *userPart= [[emailAddress.text componentsSeparatedByString:@"@"] objectAtIndex:0];