Do you remember the olden days, when Adobe AIR and Apple’s iOS didn’t seem to play nicely, when it came to orientation?
Right. Well, that was only a few months and a couple of AIR releases ago, but since then Adobe have fixed their stuff and so we have updated our e-mail extension to reflect that.
Many of you contributed with feedback and ideas to our previous post, Native extensions for mobile AIR apps – getting round the orientation issue - thanks go to all of you! Special thanks to Nicolas Jauffret for alerting us about orientation issues with the new Adobe AIR SDKs and to Dave for letting us know that messages were not received by ActionScript!
Where’s the code?
Download the extension here: http://code.google.com/p/diadraw-air-email-native-extension-example/source/checkout
1. Code has been updated to work with Adobe AIR 3.4 and iOS 6.0
- Built using Adobe Flash Builder 4.6 with Adobe AIR 3.4 and XCode 4.5 with iOS SDK 6.0
- Tested on an iPhone with iOS 6
2. No more orientation mumbo-jumbo
For those of you who will build the extension from scratch, the workaround is still there, but disabled. Uncomment the following line in MailComposerDelegate.m, if you use the extension with Adobe AIR 3.2 or older:
For details on how and why this works, have a look at our initial post: Native extensions for mobile AIR apps – getting round the orientation issue.
3. Optional HTML in the body
The extension initially was set not to use HTML at all – thanks to Chuck for his feedback on that!
We added an optional Boolean parameter to the sendMail function, so you can set from your ActionScript whether the e-mail body will have HTML turned on or off. The parameter is optional and is TRUE by default, so even if you don’t include it explicitly, your old code should still work.
For example use of sendMail have a look at FlexApp/src/views/TestEmailAppHomeView.mxml:
m_mailExtension.sendMail ( subject, body, toRecepients, ccRecepients, bccRecepients, [attachmentStr], useHtml );
4. Bug fix: not all messages from the native side were received by the ActionScript side
… and the moral of the story was: mind your variables’ lifelines! Looks like native code wasn’t holding on to the ExtensionContext instance for long enough, so any asynchronous messages that were sent after the mail composer was dismissed were lost.
Thanks to Dave for alerting us to the problem!
Let us know what you think
The community has been wonderful about providing feedback and alerting us to problems. Keep ‘em coming! You can post comments here or get in touch with us directly via email@example.com.
Our eBook, Easy Native Extensions is out!
25% off for our mailing list subscribers
- step-by-step guide to making your iOS extension in under an hour
- example code
- single-click build scripts
- debug-ready scripts for XCode