Add support for attaching NSData objects to a feedback compose view

This commit is contained in:
Andreas Linde
2014-05-25 19:18:34 +02:00
parent b48bb8fb12
commit 4f18945133
2 changed files with 5 additions and 2 deletions

View File

@@ -71,9 +71,10 @@
- NSString - NSString
- NSURL - NSURL
- UIImage - UIImage
- NSData
These are automatically concatenated to one text string, while any image attachments are These are automatically concatenated to one text string, while any images and NSData
added as attachments to the feedback. objects are added as attachments to the feedback.
@param items Array of data objects to prefill the feedback text message. @param items Array of data objects to prefill the feedback text message.
*/ */

View File

@@ -103,6 +103,8 @@
} else if ([item isKindOfClass:[UIImage class]]) { } else if ([item isKindOfClass:[UIImage class]]) {
UIImage *image = item; UIImage *image = item;
[self.attachments addObject:[BITFeedbackMessageAttachment attachmentWithData:UIImageJPEGRepresentation(image, 0.7f) contentType:@"image/jpeg"]]; [self.attachments addObject:[BITFeedbackMessageAttachment attachmentWithData:UIImageJPEGRepresentation(image, 0.7f) contentType:@"image/jpeg"]];
} else if ([item isKindOfClass:[NSData class]]) {
[self.attachments addObject:[BITFeedbackMessageAttachment attachmentWithData:item contentType:@"'application/octet-stream'"]];
} else { } else {
BITHockeyLog(@"Unknown item type %@", item); BITHockeyLog(@"Unknown item type %@", item);
} }