timeListArray是我在课堂上的全局变量 这是我的代码: -
NSData *returnData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSString *return_string5 = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
NSArray *dairyTimeParts = [return_string5 componentsSeparatedByString:@"\""];
[timeListArray removeAllObjects];
for(int i=1;i<[dairyTimeParts count]/2;i=i+2)
{
[timeListArray addObject:[dairyTimeParts objectAtIndex:2*i+1]];
}
答案 0 :(得分:1)
问题在于这一行:
NSString *return_string5 = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
简而言之,当你完成任务时alloc
你自己必须release
。尝试在[return_string5 release];
循环后添加for
。