• 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: CFPreferences and init.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFPreferences and init.


  • Subject: Re: CFPreferences and init.
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Sun, 26 Oct 2008 13:12:02 +0100


Le 26 oct. 08 à 13:02, Adam Penny a écrit :

Hi there,

Thanks for your response Kyle.
Based on that I did this in my -(id)initWithBundle method and tested it with and without a PList in the right place and it works:


servers= [[NSMutableArray alloc] init];
CFPropertyListRef serversFromPlist=CFPreferencesCopyAppValue( CFSTR("servers"), appID);
if (serversFromPlist && CFGetTypeID(serversFromPlist)==CFArrayGetTypeID())
{
[servers addObjectsFromArray: serversFromPlist];
// Get warning here: passing argument 1 of addObjectsFromArray ignores qualifiers from target
}
printers= (NSMutableArray *) CFPreferencesCopyAppValue( CFSTR("printers"), appID);


I think that the if clause protects the program from getting the wrong pointer types, but I don't feel right about letting this ride with a warning in it. Opinions?


So, tell the compiler that this is an NSArray:

	[servers addObjectsFromArray: (NSArray *)serversFromPlist];



_______________________________________________

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: CFPreferences and init.
      • From: Adam Penny <email@hidden>
References: 
 >CFPreferences and init. (From: Adam Penny <email@hidden>)
 >Re: CFPreferences and init. (From: "Kyle Sluder" <email@hidden>)
 >Re: CFPreferences and init. (From: Adam Penny <email@hidden>)

  • Prev by Date: Re: CFPreferences and init.
  • Next by Date: Re: CFPreferences and init.
  • Previous by thread: Re: CFPreferences and init.
  • Next by thread: Re: CFPreferences and init.
  • Index(es):
    • Date
    • Thread