I was wondering if it is possible to send a UIImage over bluetooth after encoding it into a NSMutableData using NSKeyedArchiver. This is what I had in mind:
NSMutableData *data = [[NSMutableData alloc] init];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
[archiver encodeObject:[UIImage imageNamed:"test.png" forKey:kImageKey];
[archiver finishEncoding];
You cannot archive
UIImageinstances like that. You will have to create an external representation first, like PNG or JPG. You can do that with for example theUIImagePNGRepresentation()function. It will return anNSDatainstance containing the compressed image in PNG format. ThatNSDatainstance can be used with NSArchiving.