Localizing the Cut|Copy|Paste menu on iOS
In the Xcode’s file tree (Project Navigator) select your project. in the right hand pane select your project again. select Info and add your language. I created a sample project, this is the result:
In the Xcode’s file tree (Project Navigator) select your project. in the right hand pane select your project again. select Info and add your language. I created a sample project, this is the result:
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
I am assuming an array, but it will work with dictionaries too. Userdefaults, Core Data and Plists can all be read/write but if you use a plist you need to pay attention in what dir you put it. See the plist part down below. Core Data I think it’s way too much overkill, it’s just … Read more
I try to write a quick and simple list of common use cases, because as @rmaddy says this answer could fill a book chapter: NSUserDefaults: stores simple user preferences, nothing too complex or secure. If your app has a setting page with a few switches, you could save the data here. Keychain (see SSKeychain for … Read more
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
Johan is right — you’re not allowed to modify your app’s bundle. You have two good options for where to save your dictionary: the documents directory, which is backed up by iTunes when a user syncs their device; or the caches directory, which is not backed up. If you don’t need to have the data … Read more
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
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
Here’s the simplest way: NSDictionary* dict = …; [dict writeToFile:@”…” atomically:YES]; See the documentation for -writeToFile:atomically:.
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]; }