开发者

Why does this sometimes crash

Inside the function

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

I create an NSString, then give cell.textLabel.text the value of this string. Then I release it. The program will crash on getting one of the fields at the end.

If I don't release the NSString, then the program doesn't crash. But won't this crea开发者_运维知识库te a memory leak?


How are you creating the NSString? If it's anything other than an alloc followed by an init, you don't need to release it!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜