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 6804181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:26:04+00:00 2026-05-26T19:26:04+00:00

I am making my app compatible to iOS 5 but the app crashes on

  • 0

I am making my app compatible to iOS 5 but the app crashes on the code where i have used setContentViewController.

Here is my code.

[[ChoicesViewController sharedChoices] setCurrentValue:[[(UIButton *)sender titleLabel]  text]];

[self.choicesPopoverController setContentViewController:[ChoicesViewController sharedChoices]];

CGFloat popoverHeight = 44.0f * [[[ChoicesViewController sharedChoices] choices] count];

[self.choicesPopoverController setPopoverContentSize:CGSizeMake(380.0f, MIN(400.0f, popoverHeight))];

if ([self.choicesPopoverController isPopoverVisible]) {

    [self.choicesPopoverController dismissPopoverAnimated:YES];

} else {

    [self.choicesPopoverController presentPopoverFromRect:[(UIButton *)sender frame]

                                                   inView:self.view

                                 permittedArrowDirections:UIPopoverArrowDirectionAny

                                                 animated:YES];

}

here is what shared choices returns:

static ChoicesViewController *_sharedChoices = nil;

 +(id)sharedChoices 
   {

    if (!_sharedChoices) 

        {
        _sharedChoices = [[[self class] alloc] init];
    }

    return _sharedChoices;
    }

//When i comment the below code , the app wont crash in iOS 5 but the UIPopover is not shown too. And if I uncomment it it will crash in iOS 5.

-(UIPopoverController *)choicesPopoverController 
{
if (!choicesPopoverController) 
     {

        choicesPopoverController = [[UIPopoverController alloc] initWithContentViewController:self];
     }

  return choicesPopoverController;
 }
  • 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-05-26T19:26:05+00:00Added an answer on May 26, 2026 at 7:26 pm

    Finally i found the solution :

    instead of writing

    [self.choicesPopoverController setContentViewController:[ChoicesViewController sharedChoices]];

    i did

    choicesPopoverController = [[UIPopoverController alloc] initWithContentViewController:[ChoicesViewController sharedChoices]];

    and commented out the this code

    /*

    -(UIPopoverController *)choicesPopoverController 
      {
        if (!choicesPopoverController) 
          {
    
              choicesPopoverController = [[UIPopoverController alloc] initWithContentViewController:self];
          }
    
       return choicesPopoverController;
     }
    

    */

    Now it doesnt crash in iOS 5.

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

Sidebar

Related Questions

I don't have much experience in making app multi lingual, but it seems to
I'm having problems making my app iPad compatible. I have an implementation of a
I am making app about google documents. but I don't know How to save
I am making an app that will play sound on events but I can't
I'm doing some work making a Java app compatible with alternative input devices. Unfortunately,
I am making an app for my college where we have to parse RSS
I am making an app that processes sensitive credit card data. If my code
I'm making my app compatible with tablets, and I am trying to understand what
I'm making my app shake-gesture-compatible by doing this in my UIViewController: - (void)viewWillAppear:(BOOL)animated {
im making an app who have a counter and a progressbar representing the time

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.