Closed mmBs closed 8 years ago
Hi, I just updated to 8.3 from 8.2 to test it out. My app is still sending an email with an attachment correctly. However, I did need to remove all calls to this plugin's isAvailable() function for Android 5 to work. I am seeing issues with other plugins though...
Hey, thanks for the comment. You are right, the plugin works but in a situation when you upgraded your iOS to 8.3 and ran the same, already installed application built in SDK 8.2 environment. However, if you compile the app using the brand new iOS SDK 8.3, the plugin stops working.
Yikes, thanks for the heads up. I'll take a closer look next week.
I'm also having an issue between iOS 8.1 and 8.3
+1 on this issue!
To ensure that we are reporting correctly, I have tried to implement sending a file attachment. The email dialog opens correctly, but it does not attach my base64-encoded file.
+1 Email dialog isn't opening on iOS 8.3 and no logs. The same code works in older iOS version.
Separate issue: 'base64Encoding' is deprecated: first deprecated in iOS 7.0. Related to the above attachment not working. Change to cdv_base64Encoding should work.
Here is a quick fix, you shouldn't do view related things in background threads. There is also a pending pull request with a try catch a [[MFMailComposeViewController alloc] init] that is below.
- (void) open:(CDVInvokedUrlCommand*)command
{
_command = command;
if (TARGET_IPHONE_SIMULATOR && IsAtLeastiOSVersion(@"8.0")) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email-Composer Plug-in"
message:@"Plug-in cannot run on the iOS8 Simulator.\nPlease downgrade or use a physical device."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[self execCallback];
return;
}
// [self.commandDelegate runInBackground:^{
NSArray* args = command.arguments;
NSDictionary* properties = [args objectAtIndex:0];
MFMailComposeViewController* draft;
draft = [self getDraftWithProperties:properties];
if (!draft) {
[self execCallback];
return;
}
[self openDraft:draft];
// }];
}
and
- (MFMailComposeViewController*) getDraftWithProperties:(NSDictionary*)properties
{
// Falls das Gerät kein Email Interface unterstützt
if (![MFMailComposeViewController canSendMail]) {
return NULL;
}
BOOL isHTML = [[properties objectForKey:@"isHtml"] boolValue];
MFMailComposeViewController* draft;
@try {
draft = [[MFMailComposeViewController alloc] init];
// Subject
[self setSubject:[properties objectForKey:@"subject"] ofDraft:draft];
// Body (as HTML)
[self setBody:[properties objectForKey:@"body"] ofDraft:draft isHTML:isHTML];
// Recipients
[self setToRecipients:[properties objectForKey:@"to"] ofDraft:draft];
// CC Recipients
[self setCcRecipients:[properties objectForKey:@"cc"] ofDraft:draft];
// BCC Recipients
[self setBccRecipients:[properties objectForKey:@"bcc"] ofDraft:draft];
// Attachments
[self setAttachments:[properties objectForKey:@"attachments"] ofDraft:draft];
draft.mailComposeDelegate = self;
return draft;
}
@catch(NSException * e) {
// do nothing, let user click on e-mail button one more time
return NULL;
}
}
+1
+1
@katzer Is there any way we could do a new release that includes #110?
Hi everyone, Someone solved it? Thanks!
+1
+1
+1
A bit out of date - I am working on a new release. The build for iOS 9 and cordova-ios-4 now runs without an issue. Please reopen if you still encounter the problem.
Please, let me know if you have the same issue - there is no exception or log, the plugin just doesn't work. If you have any solution, please let me know.