Photos Extension can cause MobileSlideShow to become unresponsive or crash after "Loading Image"

Originator:craig.hockenberry
Number:rdar://18233701 Date Originated:9/4/14
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 8.0 [12A4345d]
Classification:Crash/Hang/Data Loss Reproducible:Sometimes
 
Summary:
A Photos Extension that takes more than about a second to process an image during -finishContentEditingWithCompletionHandler: will sometimes present a "Loading Image" panel with a spinner and become unresponsive. After that spinner appears, loading the Photos Extension again can cause MobileSlideShow to crash.

Steps to Reproduce:
1) Download the Photo Editing Extension sample code from WWDC 2014:

https://developer.apple.com/devcenter/download.action?path=/wwdc_2014/wwdc_2014_sample_code/samplephotoeditingextension.zip

2) Add an artificial delay before calling the completionHandler in -finishContentEditingWithCompletionHandler:

            NSError *error = nil;
            BOOL success = [renderedJPEGData writeToURL:contentEditingOutput.renderedContentURL options:NSDataWritingAtomic error:&error];

			// DRAMA MINE
			sleep(2);

            if (success) {
                completionHandler(contentEditingOutput);
            } else {
                NSLog(@"An error occured: %@", error);
                completionHandler(nil);
            }
            break;


Expected Results:
The image should take longer to render without any side effects in the Photos user interface.


Actual Results:
Frequently, a "Loading Image" spinner will appear and the Photos app becomes unresponsive. Note that you may have to run the Photos Extension several times before seeing the spinner.

When the spinner appears, the following message is logged in the device console after 30 seconds:

Sep  4 11:22:05 PUNY MobileSlideShow[13094] <Warning>: Disabled user interaction timed out.

After that message, the processed image is not displayed in the Photos image editing user interface, but it you tap "Done", you'll see the changes have been applied to the file.

If you try to run the Photos Extension again after the timeout, you'll either see this message in the device console:

Sep  4 11:22:09 PUNY MobileSlideShow[13094] <Warning>: Ignore unbalanaced call to reenable disabled user interaction

Or MobileSlideShow will crash with the following assertion:

Sep  4 11:23:55 PUNY MobileSlideShow[13094] <Warning>: *** Assertion failure in -[PLPhotoEditRenderer createEditedImageWithCompletion:], /SourceCache/PhotoLibraryServices/MobileSlideShow-2341.4/Sources/PLPhotoEditRenderer.m:359
Sep  4 11:23:55 PUNY MobileSlideShow[13094] <Error>: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'originalImage cannot be nil while rendering'
	*** First throw call stack:
	(0x181ec6084 0x191d7c0e4 0x181ec5f44 0x182da9e20 0x18c9b965c 0x185c2d778 0x185c636e0 0x1923cd294 0x1923cd254 0x1923d103c 0x181e7d8dc 0x181e7b984 0x181da9664 0x18ad975a4 0x186562164 0x10002d488 0x1923f2a08)

The attached Assertion.txt file shows the crash in context. The Photos Extension takes 1.023 seconds to process the image, the user interface times out, and then the assertion fired causing the app to generate a crash report and tear down the XPC connection.

The crash report is attache as CrashReport.txt


Version:
iOS 8.0 [12A4345d]

Notes:


Configuration:
iPad Mini Retina [ME281LL/A]

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!