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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:10:02+00:00 2026-05-20T16:10:02+00:00

I have an application that is using a modal view that has some buttons

  • 0

I have an application that is using a modal view that has some buttons on it. When I press a button I am calling the following function:

-(IBAction)iconWasSelected:(id) sender
{
    NSLog(@"icon button was pressed");
    [self dismissModalViewControllerAnimated:YES];
}

If I remove the :(id) sender; it works just fine, but I am trying to get the object that is triggering the function.

This is the error its “vomiting”:

2011-03-11 22:59:55.793 app[14107:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[IconPickerViewController iconWasSelected]: unrecognized selector sent to instance 0x800bbf0'
*** Call stack at first throw:
(
        0   CoreFoundation                      0x01629be9 __exceptionPreprocess + 185
        1   libobjc.A.dylib                     0x0177e5c2 objc_exception_throw + 47
        2   CoreFoundation                      0x0162b6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
        3   CoreFoundation                      0x0159b366 ___forwarding___ + 966
        4   CoreFoundation                      0x0159af22 _CF_forwarding_prep_0 + 50
        5   UIKit                               0x0053da6e -[UIApplication sendAction:to:from:forEvent:] + 119
        6   UIKit                               0x005cc1b5 -[UIControl sendAction:to:forEvent:] + 67
        7   UIKit                               0x005ce647 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
        8   UIKit                               0x005cd1f4 -[UIControl touchesEnded:withEvent:] + 458
        9   UIKit                               0x005620d1 -[UIWindow _sendTouchesForEvent:] + 567
        10  UIKit                               0x0054337a -[UIApplication sendEvent:] + 447
        11  UIKit                               0x00548732 _UIApplicationHandleEvent + 7576
        12  GraphicsServices                    0x01ce4a36 PurpleEventCallback + 1550
        13  CoreFoundation                      0x0160b064 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
        14  CoreFoundation                      0x0156b6f7 __CFRunLoopDoSource1 + 215
        15  CoreFoundation                      0x01568983 __CFRunLoopRun + 979
        16  CoreFoundation                      0x01568240 CFRunLoopRunSpecific + 208
        17  CoreFoundation                      0x01568161 CFRunLoopRunInMode + 97
        18  GraphicsServices                    0x01ce3268 GSEventRunModal + 217
        19  GraphicsServices                    0x01ce332d GSEventRun + 115
        20  UIKit                               0x0054c42e UIApplicationMain + 1160
        21  naggy                               0x00002298 main + 102
        22  naggy                               0x00002229 start + 53
)
terminate called after throwing an instance of 'NSException'

Any clues?!! Help and Thanks!!

  • 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-20T16:10:03+00:00Added an answer on May 20, 2026 at 4:10 pm

    If you’re calling the method programmatically, then make sure you set the action correctly. For example, this will work when (id)sender is present:

    UIBarButtonItem *newButton = [[UIBarButtonItem alloc] initWithTitle:@"CLICK ME" 
                                                                  style:UIBarButtonItemStyleBordered 
                                                                 target:self 
                                                                 action:@selector(iconWasSelected:)];
    

    and this will work when (id)sender is not present:

    UIBarButtonItem *newButton = [[UIBarButtonItem alloc] initWithTitle:@"CLICK ME" 
                                                                  style:UIBarButtonItemStyleBordered 
                                                                 target:self 
                                                                 action:@selector(iconWasSelected)];
    

    Notice the only difference in the code is the colon!

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

Sidebar

Related Questions

I have a java application that has Web Services published using Axis. With the
I have an application that's using Oracle.DataAccess to connect. I've already discovered that the
I have an application that is using Windows Authentication and a SqlRoleProvider for user
We have an application that does single sign-on using a centralized authentication server (CAS).
I have a Windows GUI application that's using the Qt framework (currently version 3.3.5,
I have an winforms application that was built using MVC. The controller is subscribing
I have a legacy VB6 application that was built using MSDE. As many client's
I have a .NET client application that needs to communicate with a server using
I have a small VB.NET application that I'm working on using the full version
I have a mature MFC C++ application that displays on screen and prints using

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.