Where is a Mac Application’s NSUserDefaults Data Stored?

They can be found in more than one place: ~/Library/Preferences/com.example.myapp.plist ~/Library/SyncedPreferences/com.example.myapp.plist and if sandboxed ~/Library/Containers/com.example.myapp/Data/Library/Preferences/com.example.myapp.plist ~/Library/Containers/com.example.myapp/Data/Library/SyncedPreferences/com.example.myapp.plist

How can i save, retrieve, delete & update my data in Plist file in ios?

I am going through with screenshot and step by step. Please follow this and you will get your answer. First you have to create Property List through your Xcode. Step:1 Step:2 Step:3 Save data on your save button action : // Take 3 array for save the data ….. -(IBAction)save_Action:(id)sender { NSArray *paths = NSSearchPathForDirectoriesInDomains … Read more

Parse Plist (NSString) into NSDictionary

See Serializing a Property List NSData* plistData = [source dataUsingEncoding:NSUTF8StringEncoding]; NSString *error; NSPropertyListFormat format; NSDictionary* plist = [NSPropertyListSerialization propertyListWithData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error]; NSLog( @”plist is %@”, plist ); if(!plist){ NSLog(@”Error: %@”,error); [error release]; }

Working with data in iOS Apps (What to choose? NSData, CoreData, sqlite, PList, NSUserDefaults)

You can use these rules of thumb to decide what storage model will work for your app. If the data fits in memory entirely and is relatively unstructured, use plist If the data fits in memory entirely and has tree-like structure, use XML If the data does not fit in memory and has a structure … Read more

Save Data to .plist File in Swift

Apparently the file is not in a writable location, so I created it in the documents directory. var paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as String var path = paths.stringByAppendingPathComponent(“data.plist”) var fileManager = NSFileManager.defaultManager() if (!(fileManager.fileExistsAtPath(path))) { var bundle : NSString = NSBundle.mainBundle().pathForResource(“data”, ofType: “plist”) fileManager.copyItemAtPath(bundle, toPath: path, error:nil) } data.setObject(object, forKey: “object”) data.writeToFile(path, atomically: true) … Read more

NSCameraUsageDescription in iOS 10.0 runtime crash?

After iOS 10 you have to define and provide a usage description of all the system’s privacy-sensitive data accessed by your app in Info.plist as below: Calendar Key : Privacy – Calendars Usage Description Value : $(PRODUCT_NAME) calendar events Reminder : Key : Privacy – Reminders Usage Description Value : $(PRODUCT_NAME) reminder use Contact : … Read more

How to determine when Settings change on iOS

You can listen for NSUSerDefaultsDidChange-notifications with this: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(defaultsChanged) name:NSUserDefaultsDidChangeNotification object:nil]; Whenever the NSUserDefaults changes, defaultsChanged will be called. Don’t forget to call [[NSNotificationCenter defaultCenter] removeObserver:self]; when you want to stop listening for these notifications (you should also do this when object gets deallocated).