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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:19:18+00:00 2026-06-05T11:19:18+00:00

I am drawing a grid views and experiencing an EXC_BAD_ACCESS error when UIButton fires

  • 0

I am drawing a grid views and experiencing an EXC_BAD_ACCESS error when UIButton fires off a selector. Turning on zombie objects gives me the message:

*** -[FooViewController performSelector:withObject:withObject:]: message sent to deallocated instance 0x91818f0

Here is what I am doing:

BazViewController *baz = [[BazViewController alloc] initDesignatedInitializer];
FooViewController *foo = [[FooViewController alloc] initDesignatedInitializer];
[baz.view addSubview:foo.view];

I am running this on ARC, so I could see the possibility of FooViewController being prematurely deallocated.

So I did this hack:

Create an NSMutableArray ivar&property in BazViewController named viewControllers and did this instead:

BazViewController *baz = [[BazViewController alloc] initDesignatedInitializer];
FooViewController *foo = [[FooViewController alloc] initDesignatedInitializer];
[baz.view addSubview:foo.view];
[baz.viewControllers addObject:foo];

But I still get the same error above.

I proceeded to do the equivalent of the above on the view controller that deals with the grid. (Create a view controllers array, and add the object into it at time of that object’s creation). Still no dice. Can anyone recommend a another way to prevent this vc from being prematurely released?

  • 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-05T11:19:19+00:00Added an answer on June 5, 2026 at 11:19 am

    I resolved this issue myself.

    Instead of creating arrays I used addChildViewController to add a strong reference to the appropriate vc’s. No premature deallocation and no zombie objects.

    BazViewController *baz = [[BazViewController alloc] initDesignatedInitializer];
    FooViewController *foo = [[FooViewController alloc] initDesignatedInitializer];
    [baz.view addSubview:foo.view];
    [baz addChildViewController:foo];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am drawing a cube and a line grid in 3D in OpenGL: glBegin(GL_QUADS);
I'm drawing a game grid with rect() and I'd like some borders of my
In OpenGL I'm drawing a 2D isometric grid. (picture: https://i.stack.imgur.com/O4jHV.png ). Please don't mind
Drawing a blank on this, and google was not helpful. Want to make a
When drawing OpenGL ES textures, they seem to snap to round pixel locations, as
I googled for Drawing text on picturebox C# ,but I couldnt find anything useful.Then
I'm drawing some UML in which a concrete class inherits from an abstract class
I'm drawing a selection box when I click and drag on my canvas object
I am having trouble drawing a line within a group box in a simple
I'm drawing a whole bunch of Polygons onto a canvas, most of which share

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.