How to set initial values for NSUserDefault Keys?

You should use the registerDefaults method of NSUserDefaults. Prepare a plist file in your bundle that contains the default preferences and then use that plist to register the defaults. NSString *defaultPrefsFile = [[NSBundle mainBundle] pathForResource:@”defaultPrefs” ofType:@”plist”]; NSDictionary *defaultPreferences = [NSDictionary dictionaryWithContentsOfFile:defaultPrefsFile]; [[NSUserDefaults standardUserDefaults] registerDefaults:defaultPreferences]; You have to execute this code on every launch of your … Read more

brew services: where to edit configuration?

All .plist files that come with Formulas can be found in Cellar dir. For instance homebrew.mxcl.mysql.plist is in /usr/local/Cellar/mysql/5.7.14. You can modify it and  brew services will use it. Alternatively you can modify /Library/LaunchDaemons/homebrew.mxcl.mysql.plist and make it immutable with sudo chflags uchg /Library/LaunchDaemons/homebrew.mxcl.mysql.plist. This won’t allow brew to rewrite or modify .plist file.

How to read data structure from .plist file into NSArray

NSString* plistPath = [[NSBundle mainBundle] pathForResource:@”league” ofType:@”plist”]; contentDict = [NSDictionary dictionaryWithContentsOfFile:plistPath]; That answer is correct – are you sure that your file is in the app? Did you add it to your project, and check to see if it gets copied into your app bundle? If not, it might be the file was not added … Read more

Error while executing .plist file Path had bad ownership/permissions

Try changing the ownership of the .plist file: sudo chown root /Library/LaunchDaemons/myfile.plist sudo chgrp wheel /Library/LaunchDaemons/myfile.plist or more simply, change the user and group in one command: sudo chown root:wheel /Library/LaunchDaemons/myfile.plist It is also worth noting that these root LaunchDaemons can’t be world writable, for security reasons: sudo chmod o-w /Library/LaunchDaemons/*

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)