• 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: -[NSCFData count]: unrecognized selector
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: -[NSCFData count]: unrecognized selector


  • Subject: Re: -[NSCFData count]: unrecognized selector
  • From: PCWiz <email@hidden>
  • Date: Sat, 5 Dec 2009 18:16:58 -0700

You were right on with number 1, the exception was in a line of code where I tried to use NSMutableArray +arrayWithArray on an NSData object rather than an NSArray. Fixed this blunder and everything works as it should.

I'm guessing what happened here is that some part of the +arrayWithArray method tried to call +count on the object given, which in this case was an NSData.

On 2009-12-05, at 5:38 PM, Mike Abdullah wrote:

> Reasons this could be happening:
>
> 1) The exception is actually in a completely different place
> 2) _arrayController does not point to what you think it does. Could perhaps be a freed object since replaced with something else that returns a data object for -arrangedObjects
> 3) The array controller is a custom subclass that is somehow returning a data object from its -arrangedObjects method.
>
> I'm thinking 1) is most likely. By calling it an "error" suggests you don't fully understand what is going on. This is an exception. Have you used the debugger to step through the code and test? Sounds not to me.
>
> On 6 Dec 2009, at 00:23, PCWiz wrote:
>
>> I'm having an *extremely* strange problem here. I'm using this simple if statement to find out if an array controller is not empty:
>>
>> if ([[_arrayController arrangedObjects] count] > 0)
>>
>> And this is what it results in:
>>
>> -[NSCFData count]: unrecognized selector sent to instance 0x134d010
>>
>> If I take out that if statement and let the code run without a check to see if the array controller is empty, that error does not appear so I'm fairly certain that this is what's causing the issue. I've also gone through the rest of my code checking for any typos which might try to use the count method on an NSData object, but I found nothing.
>>
>> Really confused here because I've used that same if statement many times before, so I don't see why its messing up now._______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >-[NSCFData count]: unrecognized selector (From: PCWiz <email@hidden>)
 >Re: -[NSCFData count]: unrecognized selector (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re: -[NSCFData count]: unrecognized selector
  • Next by Date: NSPopUpButton questions
  • Previous by thread: Re: -[NSCFData count]: unrecognized selector
  • Next by thread: NSPopUpButton questions
  • Index(es):
    • Date
    • Thread