responseData = [NSMutableData data];を使用する場合、アプリで JSON 解析を行っています。[responseData setLength:0] でクラッシュします。
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
[responseData setLength:0]; // CRASH HERE
}
responseData=[[NSMutableData alloc]init];を使用すると、私のプログラムは正常に動作します。私はすでに.hファイルにプロパティを作成しています
@property (strong, nonatomic) NSMutableData* responseData;
.mファイルに合成します
@synthesize responseData;
質問: [NSMutableData data]と[[NSMutableData alloc]init]の違いは何ですか?
ありがとう