UIImagePickerController allows editing and crashes on iPad

Originator:yaron
Number:rdar://14963910 Date Originated:11/9/2013
Status:Closed Resolved:Open
Product:iOS SDK Product Version:7.0 GM
Classification: Reproducible:Always
 
Summary:
Creating a UIImagePickerController with UIImagePickerControllerSourceTypePhotoLibrary and displaying it on iPad inside a popover, allows entering editing mode without setting allowsEditing to YES.  In the editing image screen, pressing the delete button and confirming crashes the app.

Steps to Reproduce:
1. Create a UIImagePickerController inside a UIPopoverController:
  - (UIImagePickerController *)imagePicker {
      if (!_imagePicker) {
        _imagePicker = [[UIImagePickerController alloc] init];
        _imagePicker.delegate = self;
        _imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
        [_imagePicker setEditing:NO];
        [_imagePicker setAllowsEditing:NO];
        [_imagePicker setToolbarHidden:NO];
        [_imagePicker setNavigationBarHidden:NO];
      }
      return _imagePicker;
    }

    self.importPopover = [[UIPopoverController alloc]
                          initWithContentViewController:self.imagePicker];
    self.importPopover.delegate = self;
    [self.importPopover presentPopoverFromRect:rect inView:self.view
                      permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];

2. In the opened images screen, use the pinch gesture on one of the images to enter editing mode.
3. Press on the trash can icon and then confirm.

Expected Results:
User shouldn't be able to enter editing mode.

Actual Results:
User enters editing mode and is able to crash app:

2013-09-11 16:11:16.991 ImagePickerTester[175:60b] Failed to save context <PLSharedManagedObjectContext: 0x16e67ec0>: Error Domain=NSCocoaErrorDomain Code=134030 "The operation couldn’t be completed. (Cocoa error 134030.)" (null) (null)
2013-09-11 16:11:16.992 ImagePickerTester[175:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Failed to save context <PLSharedManagedObjectContext: 0x16e67ec0>: Error Domain=NSCocoaErrorDomain Code=134030 "The operation couldn’t be completed. (Cocoa error 134030.)" (null)'
*** First throw call stack:
(0x2fc65e8b 0x3a2ac6c7 0x362aca2d 0x2fa41855 0x3a7910ef 0x3a7939a9 0x2fc305b9 0x2fc2ee85 0x2fb99541 0x2fb99323 0x3489d2eb 0x324501e5 0x1706d 0x3a7a5ab7)
libc++abi.dylib: terminating with uncaught exception of type NSException

Version:
iOS 7.0 GM.

Notes:


Configuration:
All iPads running iOS 7.0 GM.

Attachments:
'ImagePickerTester.zip' was successfully uploaded.

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!