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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:00:00+00:00 2026-05-25T14:00:00+00:00

I am trying to put two different UIPopovers in one view. I’m fairly new

  • 0

I am trying to put two different UIPopovers in one view. I’m fairly new to objective-c, and programming in general, so instead of doing the smart, efficient method of having one popover and changing it’s contents depending on how it is called, I just used the stupid, simple method of just creating two views, two delegates, two popovers etc… I don’t know if that’s why I’m having a problem, or if it’s for some other reason.

So here’s the problem. In the viewdidload of the view where the popovers appear, I have this code:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {

    optionsViewController =[[OptionsViewController alloc]init];
    optionsViewController.delegate = self;
    popoverController = [[UIPopoverController alloc] initWithContentViewController:optionsViewController];
    popoverController.popoverContentSize = CGSizeMake(320, 216);
    [popoverController setDelegate:self];

    newCurrencyViewController =[[newCurrencyViewController alloc]init];
    newCurrencyViewController.delegate = self;
    newCurrencyPopoverController = [[UIPopoverController alloc] initWithContentViewController:newCurrencyViewController];
    newCurrencyPopoverController.popoverContentSize = CGSizeMake(320, 216);
    [newCurrencyPopoverController setDelegate:self];


}

Obviously optionsViewController is the vc that appears inside popover 1 (with popover controller called “popoverController”), and newCurrencyViewController is the vc that appears inside popover 2 (with popover controller called “newCurrencyPopoverController“).

Every time the view loads, the app crashes with a SIGABRT error, and the console says:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController initWithContentViewController:] must not be called with `nil`.'

Also, there’s a warning saying “instance method -alloc not found (return type defaults to id)” for the line that

saysnewCurrencyViewController =[[newCurrencyViewController alloc]init];

My first thought was that I had misspelled the name of a file somewhere, since I think the problem is that it isn’t finding the file called newCurrencyPopoverController, but I’ve checked everything and can’t find any misspellings or anything. Any ideas?

Thanks very much!

LUKE

  • 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-25T14:00:01+00:00Added an answer on May 25, 2026 at 2:00 pm

    You are calling methods alloc + init of your variable newCurrencyViewController but you should call them to the class of that variable!

    Line with bug:

    newCurrencyViewController =[[newCurrencyViewController alloc]init];
    

    The result of this line will be newCurrencyViewController == nil. And when you will try to init UIPopoverController with that view it will crash as you described.

    If variable newCurrencyViewController is of class, for example, CurrencyViewController then you should replace that line with this one:

    newCurrencyViewController =[[CurrencyViewController alloc] init];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to take one group and put it in two different columns. I
I'm trying to put two web projects that needs to be installed in different
I'm trying to set up two different static asset routes, and the second one
hi i'm trying to update two different tables with one trigger but i keep
I am trying to get data from two different table and put into on
I am trying to put two scatter plots next to each other with a
Simply put I'm trying to sync two slideshows created using widgetkit lib in a
I'm trying to put two buttons on the screen and set them up so
I have piece of function which I am trying to call at two different
I'm structuring a database, and found that I have two different objects I'm trying

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.