문제

is there some way to convert an NSData object, into an NSMutableData one? Basically I am using NSJSONSerialization which basically takes some JSON data I receive and transforms it into an NSData object instance. Is there anyway to then transform this into an NSMutableData object instance? I need to do this because later on, I will be spawning some threads and within the code blocks I provide, I would like to change the value of the Data object. I can't do that if its NSData but I can if its NSMutableData.

올바른 솔루션이 없습니다

다른 팁

NSMutableData * data = [NSMutableData dataWithData:jsonData];

This should solve your problem.

You can use below code:

NSData *data = ...;
NSMutableData *mutableData = [[NSMutableData alloc] initWithData:data];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top