April 2014 update: we have moved the project and packaged it with a sleek manual on our new website, along with a sleek manual and demo video. Check it out: http://easynativeextensions.com/product/diadraw-e-mail-ane/
Good morning/afternoon/fill in your timezone, AIR people!
A lot of you got in touch to tell us that the release of iOS 7 broke our e-mail ANE and asked if we could fix that.
We let most of you in on a little secret: we are preparing updates for all of our native extensions, including the e-mail one, to release on a brand new website. The website, http://easynativeextensions.com/, is dedicated to making cross-platform development dead easy and we have a few more new extensions in the bag to release on it. But, as I said, it’s a secret, so tell no one.
While the website is in development and still a couple of weeks away from seeing daylight, we thought we would get the e-mail ANE fix to you in the meantime, because we understand it sucks to have a buggy app in the App Store.
The problem
On iOS 7 the mail composer gets stuck and won’t go away after you have sent an e-mail or have tapped Cancel. You have to restart your app to make it go away. What’s worse, your users have to do it too.
If this describes the pain you are having, read on.
The fix
I’m going to tell you where the problem is in the native code and how to fix it.
That’s all very good, but could I download the ANE first?
April 2014 update: we have moved the project and packaged it with a sleek manual on our new website, along with a sleek manual and demo video. Check it out: http://easynativeextensions.com/product/diadraw-e-mail-ane/
And if you don’t want to go through the shenanigans of finding where to apply the fix, rebuild and repackage the ANE, I can’t blame you.
And now the fix
For all of you badasses out there who have built your own ANE from our code, here is how to fix it.
The problem seems to be that in iOS 7 the root view controller of the application loses track (i.e. loses the reference to) the mail controller we have asked it to present with this call:
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentViewController: mailComposer animated: YES completion: NULL];
So the next call, which worked on previous iOS versions, doesn’t do much any more:
[[[[ UIApplication sharedApplication] keyWindow] rootViewController] dismissViewControllerAnimated: YES completion:^{ [ self notifyMailComposerDismissed ]; }];
Luckily for us, mailComposer remembers who presented it, so calling this instead works:
[[ mailComposer presentingViewController ] dismissViewControllerAnimated: YES completion: ^{ [ self notifyMailComposerDismissed ]; }];
To be able to make this call at the point where the user has tapped Send or Cancel, we’ll have to keep a reference to mailComposer. And, of course, tidy it up when we are done with it.
That’s it.
I am getting following Error message while using the source code i Xcode 5. I need the Project Build Settings details.
Undefined symbols for architecture armv7:
“_EmailExtensionInitializer”, referenced from:
_g_com_adobe_air_fre_fmap in extensionglue.o
(maybe you meant: _EmailExtensionInitializer_name)
“_EmailExtensionFinalizer”, referenced from:
_g_com_adobe_air_fre_fmap in extensionglue.o
(maybe you meant: _EmailExtensionFinalizer_name)
ld: symbol(s) not found for architecture armv7
Compilation failed while executing : ld64
Hi Suresh,
Is your Xcode project set to build C++ instead of Objective-C by any chance?
Cheers,
Radoslava
Hi Rad,
I use your old example with my project in flash builder 4.7+air4.0+sdk apache flex 4.11.0. When I’m run it show error.
Process terminated unexpectedly.
The content cannot be loaded because there was a problem loading an extension: Error: Requested extension pl.randori.air.nativeextensions.ios.MailExtension could not be found.
Launch command details: “C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.11.0\bin\adl.exe” -runtime “C:\Program Files\Adobe\Adobe Flash Builder 4.7 (64 Bit)\sdks\4.11.0\runtimes\air\win” -profile mobileDevice -screensize 768×1004:768×1024 -XscreenDPI 132 -XversionPlatform IOS “E:\@job\BMWrev0.3 – 64bit\bin-debug\Main-app.xml” “E:\@job\BMWrev0.3 – 64bit\bin-debug”
How I’m fix it,please? Thanks
Hi ton,
Looks like your project is missing Piotr Koscierzynski’s ANE: pl.randori.air.nativeextensions.ios.MailExtension. The ID for ours is com.diadraw.extensions.email.NativeEmailLauncher.
Hello,
I need to know two things:
– First how can i attach image as raw data in this extension for example, i have a movieclip on stage and i took snap shot of that image using adobe png encoder, it returns byte array, so do i need to save image on the device than call here ? or guide me a proper way to do this.
– Secondly is there any Android version ANE for this extensions.
Thanks.
Hi Faisal,
You’ll need to save the file on the device and pass the path to the ANE.
We haven’t released an Android version of this ANE yet, but the guys from Distriqt have one that might work for you: http://distriqt.com/native-extensions#message-email
Greetings,
Radoslava
I download your ane! Could you please show me some Seample code ! It is kind of you to give me an instance if you want!
Hi 李晓健,
We’ve recently updated and moved our ANEs to EasyNativeExtensions.com. You can download a manual with sample code for the e-mail ANE here: http://easynativeextensions.com/product/diadraw-e-mail-ane/
What kind of app are you going to use it in?
Radoslava
I made an app by flash which encode some of my app scene to PDF and save the PDF to my document folder! And now i want to share the PDF by e_mail so your ANE is useful for me!thank you!
Now i can open the e_mail but i can not attach my attachments to my e_mail !How do i describe the _attachmentPath string Can i fix that? If my PDF in the document folder!
Hi Radoslava!
how do i write the _attachmentPath string Can i attach my attachments to my e_mail! Please show me some code!I have test many ways but fail every time!
I downloaded the ANE from your site but there are no accompanying classes… how are we supposed to use it then?
Hi Michael,
Cheers for downloading the ANE!
By accompanying classes do you mean a manual? Did the zip you downloaded contain the PDF manual? It should be the same as the one on this page: http://easynativeextensions.com/product/diadraw-e-mail-ane/
Radoslava
By accompanying classes I mean the classes used to interface with the ANE. For example, com.diadraw.extensions.mail.NativeMailWrapper, com.diadraw.extensions.mail.MailExtensionEvent and com.diadraw.extensions.email.NativeEmailLauncher.