I have a weird problem.
pictureLink is a global variable declared in .h
NSString *pictureLink;
}
@property(retain,nonatomic) NSString *pictureLink;
i wrote this code
NSString * myPictureUrl=[NSString stringWithFormat:@"http://mywebsite.com/uploads/%@.jpg",hash];
pictureLink=myPictureUrl;
I have a strange result, it must be a pointer
Or
pictureLink=[NSString stringWithFormat:@"http://mywebsite.com/uploads/%@.jpg",hash];
i have EXC_BAD_ACESS error
It’s memory management fault, you’re not retaining
myPictureUrlin your code.[NSString stringWithFormat:@"http://mywebsite.com/uploads/%@.jpg",hash];returns an autoreleased value, so you have two options:pictureLink=myPictureUrl;should look like[self setPictureLink:myPictureUrl];.[myPictureUrl retain];, and don’t forget toreleaseit later.Consider using ARC (Automatic Retain Counting) for you project. With ARC the compiler takes care of retain counts so you don’t have to, in fact aren’t allowed to. There is a refactoring that will convert a current project.