Look into my crystal ball:
You declare seconddata as an instance of NSMutableData , but then you initialize it with [NSData dataWithData:] instead of [NSMutableData dataWithData: ], so seconddata will not change at the end, and you cannot add to it.
You are trying to add to firstdata , which is also not changed.
Solution: make firstdata mutable:
NSMutableData *firstdata = [NSMutableData dataWithBytes: &lendata length: sizeof(lendata)]; [firstData appendData:[message dataUsingEncoding:NSUTF8StringEncoding]];
Then you can safely discard mdata and seconddata as they are no longer needed.
TamΓ‘s
source share