Ahhh, that's a really great tip! Thanks!!Would come in really handy!

On Tue, May 26, 2009 at 1:04 AM, Thomas Davie <tom.da...@gmail.com> wrote:

>
> Op 26 May 2009, om 09:56 heeft John Ku het volgende geschreven:
>
>  Oh so the very first return value from a Dictionary is not actually a
>> string?
>> NSString *itemA = [DictionaryA valueForKey:@"FirstProcessIdentifier"];
>>
>> I've check the apple document, valueForKey returns an ID...  so it return
>> an
>> object? how do I proceed?
>> If i cast it as NSString it gives me an error.
>>
>
> Simple - sort your type error out!  The dictionary contains at least one
> number.  This means that either you're creating it wrong, or you're trying
> to get values out of it wrong...
>
> In the latter case you might want to try something like
>
> id item = [dictionaryA valueForKey:@"FirstProcessIdentifier"];
>
> if ([item isKindOfClass:[NSString class]])
> {
>        // do stuff
> }
> else if ([item isKindOfClass:[NSNumber class]])
> {
>        // do other stuff
> }
> ...
>
>
> Bob
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to