• 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: Write to file.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Write to file.


  • Subject: Re: Write to file.
  • From: Filip van der Meeren <email@hidden>
  • Date: Mon, 15 Dec 2008 16:09:23 +0100

You are writing to a folder that is under admin rights.
Instead write to the user directory: ~/Library/Preferences/myFile.plist
Or make use of the NSUserDefaults class.

Filip van der Meeren
email@hidden
http://www.sourceforge.net/projects/perlmanager
http://www.sourceforge.net/projects/xlinterpreter

On 15 Dec 2008, at 11:25, Macarov Anatoli wrote:

I have got my own bundle that I insert into login window. When login window is started up the bundle writes necessary parametr into file which is situated in /Library/Preferences/. I try to write in the following way:
NSString *Value;
NSDictionary *theDict = [NSDictionary dictionaryWithObjectsAndKeys: Value, @"Type", nil];
if([theDict writeToFile:@"/Library/Preferences/myFile.plist" atomically:NO]){
NSString *sString = [NSString stringWithFormat:@"Saving the file Preferences"];
const char *err = [sString UTF8String];
syslog(0,err);
}else{
NSString *sString = [NSString stringWithFormat:@"There was a problem saving the file Preferences"];
const char *err = [sString UTF8String];
syslog(0,err);
}


Gives the message Error in Writing. This code works fine in application. What is another way to write into file?



________________________________________________________
Вы уже с Yahoo!?
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.yahoo.com
_______________________________________________


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

_______________________________________________

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


References: 
 >Write to file. (From: Macarov Anatoli <email@hidden>)

  • Prev by Date: Re: encoding/decoding selectors?
  • Next by Date: Re: More - Safari Download Security Alerts
  • Previous by thread: Write to file.
  • Next by thread: Write to file.
  • Index(es):
    • Date
    • Thread