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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:04:17+00:00 2026-06-08T08:04:17+00:00

In an iPhone App I’ve got a view with a button on it. The

  • 0

In an iPhone App I’ve got a view with a button on it. The Button is connected to an IBAction of MyClass.

@interface MyClass : NSObject   
-(IBAction)buttonPressed:(id)sender;
@end

As soon as I click this button, I get an EXC_BAD_ACCESS. The class MyClass was added to the view by using the “Object” component from the right sidebar.

I think this is because my custom controller gets deallocated by ARC. Is this correct? Are objects which are added via the interface controller not automatically retained? How to retain the instance which I have connected via interface builder?

  • 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-08T08:04:18+00:00Added an answer on June 8, 2026 at 8:04 am
    1. MyClass must be a subclass of UIView, not NSObject.

    2. If you think an object is being deallocated prematurely, implement the -dealloc method and add some logging and a breakpoint.

    3. If your custom view is on screen then its superview will hold a reference to that view and it will not be deallocated. If your custom view controller has a parent view controller such as a UINavigationController then its parent view controller will hold a reference to your view controller and it will not be deallocated.

    4. Set a breakpoint in your -buttonPressed: method to confirm that it’s being called correctly. Then step through the code.

    5. Look at the call stack at the time of the EXC_BAD_ACCESS to better isolate where the problem is. Is your -buttonPressed: method actually being called?

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

Sidebar

Related Questions

My iphone App shows a table view having list of 6000 items. (these items
My iPhone app has a tab bar controller at the bottom of the view
My iphone app have login screen, and logout button in the app, requierment was
My iPhone app (based on the Single View Application of Xcode) has a UITextView
My iPhone app can't seem to use soft keyboards that doesn't use the US-like
my iphone app crashes unexpectedly and looking at the crash log I can't tell
The iPhone app that I am working on requires GET calls to a 3rd
My iPhone app started logging this error: lo->hi recycling invariant violated! followed by: Program
My iPhone app generally uses under 5MB of living memory and even in the
My iphone app called Google Local Search(non javascript version) to behave some search business.

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.