I am sure that I should use NSMutableData for this problem, as I will access the object several times and add each section of the data as soon as I get it.
The problem I am facing is that I want to create one large NSMutableData object that will be created by several small NSData objects that are added to the end of the mutable data object
I have tried the following.
EDIT: // This method now works and adds the data as its intended.
- (void) constructRequest { NSData * protocolInt = [self addProtocolVersion]; NSMutableData * myMutableData = [[NSMutableData alloc] init]; NSData *first_data = [self addProSig];
First of all, I'm not even sure if this is the right way to add data. I just saw several similar examples. The main problem is that on two lines here
NSMutableData *first_data = [self addProSig]; //nsdata type NSMutableData *second_data = [self addAct]; //nsdata type
I have warnings on both lines
incompatible pointer types initializing an 'NSMutableData * _strong' wuth expression of type "NSData *"
any help would be appreciated. The best solutions I use, if any, are also possible.
source share