• 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: Writing out a BOOL value to a .plist
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Writing out a BOOL value to a .plist


  • Subject: Re: Writing out a BOOL value to a .plist
  • From: Dirk Stegemann <email@hidden>
  • Date: Sat, 27 May 2006 04:04:10 +0200

Hi,

Am 26.05.2006 um 22:40 schrieb Scott Mitchell:

Thanks that works. I don't know why I did not see that method. I know I have used this before.
(...)
[ dictInfo setObject: [ NSNumber numberWithBool: YES ] forKey: BBDM_gadget ]


Just to provide an alternativ way which is also working fine, but -- thanks to toll-free bridging of CoreFoundation's CFBooleanRef type (which is a valid plist type) -- doesn't require to send a method to the NSNumber class:

- (void)setBoolValue:(BOOL)theBOOL forKey:(NSString*)theKey intoDict: (NSMutableArray*)theDict;
{
[theDict setObject:(id)(theBOOL ? kCFBooleanTrue : kCFBooleanFalse) forKey:theKey];
}



Not sure how expensive 'CFBooleanGetValue()' is, though:

- (void)boolValueForKey:(NSString*)theKey fromDict:(NSMutableArray*) theDict;
{
return CFBooleanGetValue([theDict objectForKey:theKey]);
}




Regards,
Dirk Stegemann



_______________________________________________
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


References: 
 >Writing out a BOOL value to a .plist (From: Scott Mitchell <email@hidden>)
 >Re: Writing out a BOOL value to a .plist (From: Andrei Tchijov <email@hidden>)
 >Re: Writing out a BOOL value to a .plist (From: Scott Mitchell <email@hidden>)

  • Prev by Date: Re: [Q] omissible method declaration in interface file
  • Next by Date: Re: Determining how the app is run (intel/ppc/rosetta/os version)?
  • Previous by thread: Re: Writing out a BOOL value to a .plist
  • Next by thread: Re: Writing out a BOOL value to a .plist
  • Index(es):
    • Date
    • Thread