I have the following properties defined:
@property (nonatomic, retain) NSString *name_;
@property (nonatomic, retain) NSString *profilePicture_;
@property (nonatomic, retain) NSString *username_;
@property (nonatomic, retain) NSString *id_;
and I set them up in my init...
like this:
-(id)initWithData:(NSDictionary *)data
{
self = [super init];
if (!self) {
return nil;
}
name_ = [data valueForKey:@"full_name"];
profilePicture_ = [data valueForKey:@"profile_picture"];
username_ = [data valueForKey:@"username"];
id_ = [data valueForKey:@"id"];
return self;
}
with the following dealloc
:
-(void)dealloc
{
[name_ release];
[username_ release];
[profilePicture_ release];
[id_ release];
[super dealloc];
}
However the dealloc
gives me an error:
pointer being freed was not allocated
Why is this? Do I have to do [[NSString alloc] init...]
or [NSString stringWithString:]
?