Instruments (Leaks) and NSDateFormatter

后端 未结 3 1186
故里飘歌
故里飘歌 2021-01-13 23:57

When I run my iPhone app with Instruments Leaks and parse a bunch of NSDates using NSDateFormatter my memory goes up about 1mb and stays even though these NSDates should be

3条回答
  •  耶瑟儿~
    2021-01-14 00:15

    There may be a problem with NSDateFormatter parsing date strings with time zones because when I changed the formatter pattern to remove the timezone portion the problem disappeared.

    I changed it from this:

    [df setDateFormat:@"EEE, d MMM yyyy H:m:s z"];
    

    To this:

    [df setDateFormat:@"EEE, d MMM yyyy H:m:s"];
    

    But now the problem is the dates don't get the right timezone so I'll have to have to determine the timezone myself.

提交回复
热议问题