addAttachmentData slow in iOS 9

Hi,


The addAttachmentData method of MFMailComposeViewController appears to be very slow in iOS 9.

In iOS 8 it took 1 second to add an attachment to a mail.

Now in iOS 9 (GM) it takes more than 10 seconds for the same data.

It does not seem to depend on the data size.

Even with one byte of data the delay occurs.

Anybody aware of fixes for this?

Replies

Does it depend on the type of data or device? I am attaching an png file (mimeType:"image/png"), and it happens very quickly on an iPad 3 WiFi. (MFMailComposeViewController is still broken on iOS 9 simulator)

Have both mimeTypes @"image/png" and @"text/plain", so two attachment types in one mail.

Indeed after closer inspection, the image/png is fast but the text/plain is slow.

Response time about 5 seconds on an iPad mini 2.

But in combination with a specific file extension for the app document it becomes very slow.

No problem in iOS 8 (response time 1 sec)


Have filed a bug report.

Have added a simple HelloWorld app to this bug report, which reproduces the problem.

Hope they will respond soon.

Problem not yet solved in the new iOS 9 (build 13A344).

Same here - iOS 9 (build 13A344). Dreadfully slow.

Have sent more pronounced test results to Apple, only text/plain attachments are created in a simple loop.

Each attachment has the same short C string "x".


Response times:

iPhone 3GS, iOS 6.1.3 : 1 sec

iPhone 4S, iOS 8.4.1 : < 1 sec

iPad mini 2, iOS 9: 48 sec


Given the speed differences of the test devices, at least a factor 100 slower in iOS 9.


Sample code:


char str[10];

strcpy(str, "x");

NSData * myData = [NSData dataWithBytes:str length:strlen(str)];

for (long i = 0; i < 10;i++) {

NSString* fname = [NSString stringWithFormat: @"attach%ld.myextension", i];

[mailer addAttachmentData:myData mimeType:@"text/plain" fileName:fname];

}


Have attached a sample XCode project with this coding to the bug report.

Hope it will now be accepted as a real issue.

Not yet solved in 9.0.1, so still a factor 100 slower than in iOS 8.

😟

I am seeing the exact same issue on 9.0.1

iOS 9.0.2 seems to be twice as fast as iOS 9.0.1, so still about 50 times slower than iOS 8.4.

I'm seeing the same problem, extremely slow. The calls the addAttachmentData are fast, but ones the viewcontroller is up it spends forever populating the email with a .CSV and JPG images.

Results in iOS 9.1 beta 3 are the same as in iOS 9.0.2, so still 50 times slower than iOS 8.4.1 and earlier versions.

Tested with IOS 9.1 beta 4. No improvement yet.

No improvement with iOS 9.1 beta 5.

Same problem. Any workarounds or should we wait for Apple to fix it?

I am noticing the same problem. I did some digging and timed my app. I attached 2 graphics files, a .csv file and 3 small audio files. I generate and attach all of these apps to the MFMailComposeViewController object and get a call back from the presentViewController completion block all in less than 2 seconds. The blank email with the filled in subject line appears immediately but the content of the email takes about 15 seconds to appear on my iPhone 5s. One of my customers with an iPhone 5 claims it is taking 30 seconds.


I did some profiling and noticed that my app has heavy CPU useage for about 2 seconds and then accountsd uses most of the CPU followed by Mobile Mail. My understanding is that accountsd has something to do with iCloud. I think this is something Apple has to fix.

Same problem for me but using UIActivityViewController and in this case I do not have nay way to inform the user to way.

I hope Apple will fix soon