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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:31:03+00:00 2026-05-23T18:31:03+00:00

I have delegate @property (nonatomic, assign) id <DelegateProtocol> delegate; but it crash on performSelector

  • 0

I have delegate

@property (nonatomic, assign) id <DelegateProtocol> delegate;

but it crash on performSelector

if (_delegate != nil && [_delegate conformsToProtocol:@protocol(DelegateProtocol)])
{
    NSObject *obj = _delegate;
//HERE IS EXC_BAD_ACCESS
    [obj performSelectorOnMainThread:@selector(didTouchImageView:) withObject:self waitUntilDone:NO];
}

I set delegate here:

- (void)viewDidLoad
{
    [super viewDidLoad];
    [invoiceTabImage setDelegate:self];
}

and the question is why it might be.

  • 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-23T18:31:04+00:00Added an answer on May 23, 2026 at 6:31 pm

    EXC_BAD_ACCESS means that your delegate was already deallocated when you sent it the message didTouchImageView (I assume that everything is ok when you send the message performSelector, it would be too easy).

    First of all, check the retain/release management for your delegate to see if there is anything incorrect.

    If everything seems ok, one possibility to debug this is enabling Zombies (you can do through Instruments/Run with performance tool, or by setting an environment variable when debugging).

    This could help you detect the cause of the problem.

    If you need more help, please, post the code about how you create/retain/release your delegate object, and also paste the stack trace of the crash.

    EDIT:

    Two hints:

    1. the key to working with delegates (without retaining them) is ensuring that the view controller (that in your case is also the delegate) lives longer than invoiceTabImage; you can then review invoiceTabImage‘s lifecycle (when it is created/released) and compare it to the delegate’s;

    2. in your controller’s dealloc, add this line:

      invoiceTabImage = nil;

      so that you are ensuring that when the controller/delegate is removed, the delegating object knows that the delegate is not there anymore; the program will not work, but possibly will not crash.

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

Sidebar

Related Questions

Possible Duplicate: Are @property(nonatomic)ivar @property(nonatomic,assign)ivar the same or different? i have seen in many
Here is my setup. In my application delegate, I have a property called currentFoo.
I have a class MyCLController with a property dataSource that is data source delegate
I have defined a property in application delegate.h and synthesized it in delegate.m file
I have defined a delegate protocol in my custom class this way: #import <Foundation/Foundation.h>
I have set up a delegate for my class 'HotRequest', but am having problems
Does the Java language have delegate features, similar to how C# has support for
When i have delegate like public delegate void PrintMe(); (1) PrintMe a = delegate()
I have this delegate in C#. public delegate string ACSharpDelegate(string message); How would I
Can we have same delegate for two events ? which have same number of

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.