• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: -performSelector: exception... in one build configuration
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -performSelector: exception... in one build configuration


  • Subject: Re: -performSelector: exception... in one build configuration
  • From: Steve Christensen <email@hidden>
  • Date: Wed, 02 Nov 2011 06:45:02 -0700

Yes. The following is printed in the console:

-[NSUserDefaults foo]: unrecognized selector sent to instance 0x12c760

and the stack looks like this at the time:

#0  0x369c815e in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
#1  0x369c7648 in ___forwarding___ ()
#2  0x3693e180 in __forwarding_prep_0___ ()
#3  0x3695cd7a in -[NSObject(NSObject) performSelector:] ()


On Nov 1, 2011, at 10:41 PM, Ludovic Nicolle wrote:

> strange.
>
>
> so if you have two lines of code back to back that are:
>
> [[NSUserDefaults standardUserDefaults] foo];
> [[NSUserDefaults standardUserDefaults]  performSelector: @selector(foo)];
>
> The first line executes and you can trace it, while the second crashes?
>
> Ludo
>
> On 2011-11-01, at 10:23 PM, Steve Christensen wrote:
>
>> No, I don't think this is a Cocoa issue.
>>
>> I recently moved an app project from Xcode 3.2.6/iOS 4.3 to Xcode 4.2/iOS 5.0. The project is set up to build debug (no optimizations, debug-only status and error messages in the code), release (full optimization, code stripping, etc. for local testing), and distribution (same as release except for an app store distribution profile) configurations.
>>
>> Today I ran into something weird. My app includes a category on NSUserDefaults that adds some app-specific getter/setter methods. In most cases I'm just calling, e.g., [[NSUserDefaults standardUserDefaults] foo], but for one case I'm using [[NSUserDefaults standardUserDefaults] performSelector:@selector(foo)].
>>
>> This worked just fine for previous builds (all configurations) with Xcode 3.2.6, and works fine for simulator builds (debug/release) and device builds (debug), but crashes with an unknown selector exception for a release device build. While trying to track down what's going on, I added a NSLog call that prints the result of -respondsToSelector: for that message selector and it says that the selector exists for all the cases that don't crash, and that it doesn't exist for the case where it crashes.
>>
>> Note that there are several methods in the NSUserDefaults category that are also called in both ways, and except for one getter/setter pair, all of the direct method calls and -performSelector: calls work fine for all configurations.
>>
>> Does anyone have some ideas on what might be going on here? I haven't seen something like this happen before unless the selector really doesn't exist.
>>
>> steve

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >-performSelector: exception... in one build configuration (From: Steve Christensen <email@hidden>)

  • Prev by Date: Re: Symbol Navigator
  • Next by Date: Re: -performSelector: exception... in one build configuration
  • Previous by thread: Re: -performSelector: exception... in one build configuration
  • Next by thread: Re: Static Analyzer Problems
  • Index(es):
    • Date
    • Thread