• 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
Objective-C coding question..
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Objective-C coding question..


  • Subject: Objective-C coding question..
  • From: Clark Williams <email@hidden>
  • Date: Wed, 21 Jul 2010 16:29:14 -0700

Suppose you have a NSDictionary* instance called temp.
You've setup everything including the plist. The plist consists of:
KeyName ValueType
numKey0 NSNumber
strKey1 NSString
strKey2 NSString
strKey3 NSString
strKey4 BOOL+
<code_fragment_begins>
    [self setKey0:[temp objectForKey:@"numKey0"]];
    [self setKey1:[temp objectForKey:@"strKey1"]];
    [self setKey2:[temp objectForKey:@"strKey2"]];
    [self setKey3:[NSMutableString stringWithString:(NSMutableString *)[temp objectForKey:@"strKey3"]]];
<code_fragment_ends>

Now the question. How do I reference the BOOL?
If I try the following:
    BOOL widget = @(BOOL *)[temp objectForKey:@"strKey4"];
I get a bad value.
If I try anything with the RHS set to:
(BOOL*)[temp objectForKey:@"strKey4"];
I get a warning: invalid receiver type 'BOOL *'

I also tried BOOL widget = [temp boolValueForKey:@"strKey4"];

I got a warning saying: 'NSDictionary' may not respond to '-boolForKey:'

BTW all the other key values are passed correctly except the BOOL.

So...flummoxed!
Suggestions?
TIA
ClarkW
 _______________________________________________
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

  • Follow-Ups:
    • Re: Objective-C coding question..
      • From: Wyatt Webb <email@hidden>
    • Re: Objective-C coding question..
      • From: Carter Allen <email@hidden>
  • Prev by Date: Re: Making my code into an .app file/folder
  • Next by Date: Re: Objective-C coding question..
  • Previous by thread: Re: What does this link warning mean? can’t add line info to anonymous symbol
  • Next by thread: Re: Objective-C coding question..
  • Index(es):
    • Date
    • Thread