• 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
Why doesn't CFDictionaryContainsKey() work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why doesn't CFDictionaryContainsKey() work?


  • Subject: Why doesn't CFDictionaryContainsKey() work?
  • From: "Alan Smith" <email@hidden>
  • Date: Thu, 16 Nov 2006 11:07:34 -0500

I added in my category of NSDictionary a method:

- (BOOL)hasKey:(id)key
{
	return CFDictionaryContainsKey(self, *key);
}

I didn't get any compiler errors or warnings but when I used it, it
returned 0 every time. So I changed it to this:

- (BOOL)hasKey:(id)key
{
	return [[self allKeys] containsObject: key];
}

And that works fine. The only problem I have with the latter code is
that allKeys may be very big and would slow my program down and use a
big chunk of memory.

So, if anyone can quell these fears please tell me.

Cheers, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unnecessary, then it
shall evolve."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Why doesn't CFDictionaryContainsKey() work?
      • From: AurĂ©lien HugelĂ© <email@hidden>
    • Re: Why doesn't CFDictionaryContainsKey() work?
      • From: Shawn Erickson <email@hidden>
  • Prev by Date: Re: Garbage collection in Leopard (not an NDA question)
  • Next by Date: Re: Why doesn't CFDictionaryContainsKey() work?
  • Previous by thread: Re: Garbage collection in Leopard (not an NDA question)
  • Next by thread: Re: Why doesn't CFDictionaryContainsKey() work?
  • Index(es):
    • Date
    • Thread