开发者

NSDateFormatter Memory Leak Issue

I've read this post: (NSDateFormatter leak question) which states that NSDateFormatter leaks when the Z is used in the date/time. My date format happens to be as follows: 2011-08-15T22:58:24-07:00

Yet for some reason it's also telling me that NSDate is leaking. Here's the code that's in my init method:

NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
[sel开发者_如何学编程f setCreatedAt:[formatter dateFromString:hCreatedAt]];
[formatter release];

Any ideas on a workaround to this? It would be much appreciated! Just an FYI .. this is ISO 8601 format. I could possibly switch the format if necessary. If that's required, please suggest the proper date/time format I should use.


The solution ended up being that I had to use

[formatter setDateFormat:] //and
[formatter setLocale:]

In order to avoid the memory leak.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜