Native share and native email not working in iOS 5.1.1 ?

29 views
Skip to first unread message

timo.v...@gmail.com

unread,
Feb 2, 2014, 2:30:50 PM2/2/14
to codenameone...@googlegroups.com
My app uses native share and native email (with an attachment) without problems on Android, but the same code crashes my iOS 5.1.1 iPad.
I wrapped the call with exception handing, but the app apparently crashes inside the native code.

Should native share and email (with a file attachment) work at all on iOS 5.1.1 ?

Shai Almog

unread,
Feb 3, 2014, 2:08:38 AM2/3/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
Hi,
native share isn't available on iOS prior to OS 6. I'll fix it to fallback to lightweight share.
E-mail attachment should work though how are you using email?

timo.v...@gmail.com

unread,
Feb 3, 2014, 4:39:17 AM2/3/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
Hi Shai,

Thanks for the quick response.

Although a fallback to lightweight share is much better than a crash, it has the drawback of not being language-independent.

This is the code that fails on iOS 5.1.1 while sending an email:

OutputStream stream = null;
try {
    FileSystemStorage filesystem = FileSystemStorage.getInstance();
    String path = filesystem.getAppHomePath() + filesystem.getFileSystemSeparator() + "file.csv";
    stream = FileSystemStorage.getInstance().openOutputStream(path);

    writeFile(stream);

    Message message = new Message("See attached file");
    message.setAttachmentMimeType("text/csv");
    message.setAttachment(path);
    Display.getInstance().sendMessage(null, "Your CSV file", message);
} catch (Exception e) {
  throw new FileSaveException(e);
} finally {
  Util.cleanup(stream);
}

I hope you can point out from this code fragment what could be causing the crash.

Shai Almog

unread,
Feb 3, 2014, 12:47:51 PM2/3/14
to codenameone...@googlegroups.com, timo.v...@gmail.com
Hi,
the null is causing the crash. You need to provide an address for iOS.
Reply all
Reply to author
Forward
0 new messages