سؤال

My problem is the next> I have to receive data from an external accessory and save it into a big NSData, each time I receive a stream I have to copy that NSData into another one:

CompleteNSData = NSDataTx1 + NSDataTx2 + NSDataTx3;

and at the end show the whole info to the user.

هل كانت مفيدة؟

المحلول

Edited since the question was changed:

If you need to concatenate multiple NSData objects into one then something like this will work:

NSData *data1 = ... // the 1st NSData object
NSData *data2 = ... // the 2nd NSData object
NSData *data3 = ... // the 3rd NSData object
NSMutableData *completeData = [data1 mutableCopy];
[completeData appendData:data2];
[completeData appendData:data3];

Call appendData: for each NSData you need to append.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top