Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8018443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:07:54+00:00 2026-06-04T21:07:54+00:00

I have a UIImagePickerController that i display in a popover when the user presses

  • 0

I have a UIImagePickerController that i display in a popover when the user presses a button. This functions perfectly normal in the iPad simulator, but when I try to do the same thing on an actual test device, I get an NSRangeException on the alloc/init line for my image picker!

    imagePicker = [[UIImagePickerController alloc] init];//Crashes here on device
    imagePicker.delegate = self;
    imagePicker.allowsEditing = YES;
    imagePicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
    imagePicker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) (kUTTypeImage), nil];

Here is the crash message:

* Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘* -[NSOrderedSet initWithOrderedSet:range:copyItems:]: range {8, 1} extends beyond bounds [0 .. 0]’

I have determined it is that exact line by attempting to step over the line in debug mode, and stepping over that particular line is what causes the exception to be thrown.

EDIT:

I was able to make a basic project that reproduces this issue 100%, which leads me to believe this is an iOS bug, not something with my code.

  1. Make a new project. Select single view application. Does not matter if it is storyboard or xib-based
  2. Open the iPad xib/storyboard, add a roundrectbutton to the view
  3. Add the following IBAction to the viewcontroller. pickerPopoverController is a __strong ivar

    -(void)iMakeItCrash:(UIButton*)sender
    {
        UIImagePickerController* ip = [[UIImagePickerController alloc] init];
        ip.delegate = self;
        ip.allowsEditing = YES;
        ip.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
        ip.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) (kUTTypeImage), nil];
    
        pickerPopoverController = [[UIPopoverController alloc] initWithContentViewController:ip];
        [pickerPopoverController presentPopoverFromRect:sender.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    }
    
  4. Hook up this IBAction to the button’s Touch Up Inside event.

  5. Works on simulator, crashes on iPad

EDIT2:

Crash still happens if I try to use presentPopoverFromBarButtonItem:. However, doesn’t crash if I don’t present the image picker at all…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:07:56+00:00Added an answer on June 4, 2026 at 9:07 pm

    I noticed this when my app crashed on an empty ‘Saved Photos’ album on any of my devices, or the simulator. If Saved Photos has photos in it the bug doesn’t happen. It is easy to replicate if you use Reset Data and Settings on the simulator, and leave your albums empty.

    I’ve spent ages trying to find a workaround but I haven’t been able to. I think filing an iOS bug report is a real good idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app where I display the photo chooser (UIImagePickerController) but after the
I have a UITableViewController that pops up a UIImagePickerController, user takes a pic, hits
I'm developing this application on an iPad. It has a function that allows user
I have a setter like this: - (UIImagePickerController *) foto { if (_foto ==
I have found a lot of information on using UIImagePickerController to let the user
Have data that has this kind of structure. Will be in ascending order by
Have data that has this kind of structure: $input = [ { animal: 'cat',
My application has a 'Browse' button with these codes that allows user to browse
I have a UIImagePickerController subclass, and I would like to detect when the user
I know that there are other questions that deal with this error, but those

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.