Fix crash when attaching media

Seems these crashes were introduced when transitioning from
DJWActionSheet -> UIAlertController

// FREEBIE
pull/1/head
Michael Kirk 9 years ago
parent 6b67dc4ef5
commit c1ab36576e

@ -1625,7 +1625,9 @@ typedef enum : NSUInteger {
picker.mediaTypes = @[ (__bridge NSString *)kUTTypeImage, (__bridge NSString *)kUTTypeMovie ]; picker.mediaTypes = @[ (__bridge NSString *)kUTTypeImage, (__bridge NSString *)kUTTypeMovie ];
picker.allowsEditing = NO; picker.allowsEditing = NO;
picker.delegate = self; picker.delegate = self;
[self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]]; dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]];
});
} }
alertActionHandler:nil]; alertActionHandler:nil];
} }
@ -1639,7 +1641,9 @@ typedef enum : NSUInteger {
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self; picker.delegate = self;
picker.mediaTypes = @[ (__bridge NSString *)kUTTypeImage, (__bridge NSString *)kUTTypeMovie ]; picker.mediaTypes = @[ (__bridge NSString *)kUTTypeImage, (__bridge NSString *)kUTTypeMovie ];
[self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]]; dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]];
});
} }
/* /*
@ -1755,22 +1759,24 @@ typedef enum : NSUInteger {
attachmentIds:[NSMutableArray new]]; attachmentIds:[NSMutableArray new]];
} }
[self dismissViewControllerAnimated:YES dispatch_async(dispatch_get_main_queue(), ^{
completion:^{ [self dismissViewControllerAnimated:YES
DDLogVerbose(@"Sending attachment. Size in bytes: %lu, contentType: %@", completion:^{
(unsigned long)attachmentData.length, DDLogVerbose(@"Sending attachment. Size in bytes: %lu, contentType: %@",
attachmentType); (unsigned long)attachmentData.length,
[self.messageSender sendAttachmentData:attachmentData attachmentType);
contentType:attachmentType [self.messageSender sendAttachmentData:attachmentData
inMessage:message contentType:attachmentType
success:^{ inMessage:message
DDLogDebug(@"%@ Successfully sent message attachment.", self.tag); success:^{
} DDLogDebug(@"%@ Successfully sent message attachment.", self.tag);
failure:^(NSError *error) { }
DDLogError( failure:^(NSError *error) {
@"%@ Failed to send message attachment with error: %@", self.tag, error); DDLogError(
}]; @"%@ Failed to send message attachment with error: %@", self.tag, error);
}]; }];
}];
});
} }
- (NSURL *)videoTempFolder { - (NSURL *)videoTempFolder {

Loading…
Cancel
Save