I want to write binary data to a file and add that as an email attachment.
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSData *data = [[self.samples componentsJoinedByString:@"\n"] dataUsingEncoding:NSUTF8StringEncoding];
[picker addAttachmentData:data mimeType:@"application/octet-stream" fileName:filename];
addAttachmentData expects an NSData * to be passed (although I'd prefer a byte array). samples is an NSMutableArray *. I'm getting extra formatting in the file that I do NOT want however, like angle brackets and whitespace:
...
<17700000 16c0f710 c78a2660 1570f960 c78926>
<17710060 17d0f800 c98826d0 2160f990 cb8d26>
...
Where are these coming from? How can I truly write just binary data?