我在我的項目中使用了Json框架。內存管理 - 目標C
我解析JSON響應如下,
- (void)parseResponse:(NSData*)responseData
{
NSMutableString *responseString = [[NSMutableString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSDictionary *responseDic = [responseString JSONValue];
NSString *responseDataString = [responseDic objectForKey:NSLocalizedString(@"JSON_RESPONSE_DICTIONARY_KEY", nil)];
[responseString release];
}
那麼,是不是正確的,如果我呼籲responseString釋放,因爲我做了?
編輯
我沒有如下,
NSMutableString *responseString = [[NSMutableString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSDictionary *responseDic = [responseString JSONValue];
NSString *responseDataString = [responseDic objectForKey:NSLocalizedString(@"JSON_RESPONSE_DICTIONARY_KEY", nil)];
NSDictionary *responseDataDic = [responseDataString JSONValue];
[responseString release];
我想現在我很安全。
不僅正確,但必要 – MByD 2012-03-15 10:55:03
此外,該陳述的順序是不正確的... – Ilanchezhian 2012-03-15 11:03:06
哦是的是的。我修好了它。感謝很多Aadhira – chinthakad 2012-03-15 11:26:09