MailComposer breaks on iOS

Hello,

I am trying to send an attachment with the composeAsync method of MailComposer, this is working on Android, but fails on iOS with the following error:

*** -[NSPlaceholderString initWithString:] nil argument

The way I call the function is

MailComposer.composeAsync({
		recipients: [ user.email ],
		subject: `Exporting ${ document.filename }`,
		body: 'This is a file exported by app',
		attachments: [
			`${ FileSystem.cacheDirectory }${ document.filename }`,
		],
	})

the file exists (checked with FileSystem.getInfoAsync). I use the cacheDirectory instead of documentDirectory
as I found a discussion mentioning that MailComposer cannot access documentDirectory, but this does not solve my problem. As mentioned, the same piece of code works correctly on Android

Any help, will be greatly appreciated. Thank you.

Hey @pierref,

This certainly seems like it has the makings of a bug. Do you think you could create a github issue for this here: Issues · expo/expo · GitHub that has a way to reproduce the error either via github repo or more ideally a Snack?

Cheers,

Adam

Hello @adamjnav
Sadly MailComposer is explicitly disabled on Snack. In the meantime, I have narrowed down the origin of the problem: the red screen happens when trying to attach using an uri which filename has no extension. Adding any extension when naming the file makes the mailer opens correctly.

I have created a small code to demonstrate the problem and posted it when opening this issue:
https://github.com/expo/expo/issues/3237

All the best
Pierre —

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.