• 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: nil in cocoa collections
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nil in cocoa collections


  • Subject: Re: nil in cocoa collections
  • From: Fritz Anderson <email@hidden>
  • Date: Wed, 14 Mar 2012 11:02:01 -0500

On 14 Mar 2012, at 9:49 AM, Ariel Feinerman wrote:

> I have an mystique behavior  in the NSMutableDictionary
>
> one cannot while one contains a nil for key and value so when print in
> nslog


> {
> 	"key" = "value";
> 	(null) = (null);
> }

(Edited for readability) Am I to understand that this is some kind of notation like text property list or JSON?

> one is not an NSNull

Which one is the NSNull? And how are you attempting to put the nil/NULL/NSNull into the dictionary? Indeed, how are you creating/building the dictionary at all?

> then
>
> NSArray *keys = [_f allKeys];
>
> throwing an exception
>
> Terminating app due to uncaught exception 'NSInvalidArgumentException',
> reason: '*** -[NSArray initWithObjects:count:]: attempt to insert nil
> object at objects[31]'

The exception means what it says. You can't have nil keys or values in Cocoa collections. I'm surprised it got as far as -allKeys, unless you aren't telling us something.

Show your code.

	— F


_______________________________________________

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


  • Follow-Ups:
    • Re: nil in cocoa collections
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >nil in cocoa collections (From: Ariel Feinerman <email@hidden>)

  • Prev by Date: Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?
  • Next by Date: Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?
  • Previous by thread: nil in cocoa collections
  • Next by thread: Re: nil in cocoa collections
  • Index(es):
    • Date
    • Thread