plist

How can I save an Objective-C object that's not a property list object or is there a better way for this than a property list?

早过忘川 提交于 2019-12-23 09:40:10
问题 I'm writing a Cookbook application, and I've not been able to find anything on how to save the data of a class I've created (the Recipe class). The only way I've seen would be to possibly save the contents of this class as a whole without individually saving every element of the class for each object by making this method for my Recipe class: -(void) writeToFile:(NSString *)file atomically:(BOOL)atomic{ } But I have absolutely no idea how I'd go about implementing this to save this object to

iPhone - upgrading from old app preferences

三世轮回 提交于 2019-12-23 05:48:46
问题 If I build a 1.0 app with 2 strings in the defaults, using registerDefaults . And in a 2.0 version, I decide to remove the first old string, and move the second one (changing its key string) with a new third one into an array. How may I deal with this and how to deal with the changes that could have been made to the content through versions. 1.0 Prefs should be StringKey someValue DateKey 10/10/2010 1.1 Prefs should be StringKey someValue DateKey 2010/10/10 2.0 Prefs should be Array Item0 is

Swift - searching through dictionaries in an array in a plist

主宰稳场 提交于 2019-12-23 05:11:05
问题 I'm making a simple app that searches through a large plist that contains geographical fixes, with corresponding lat and long coordinates. The plan is to be able to search for these fixes in a search box, and then push a button to position a mapview with the fix in the center, and a pin at the exact coordinates. I have the interface setup, the map working and just need to enable the button to search for the fix that the user inputs, return the lat long, and forward these to the map. I've been

Mapping a dictionary to an array of structs in Swift

对着背影说爱祢 提交于 2019-12-23 04:48:29
问题 My app needs to represent an array of presets, where a preset is represented by the following struct: struct Preset: Codable { var name: String var value: Int } Using NSUserDefaultsController , NSTableView and CocoaBindings, I was able to create a Preferences window where I can add and remove presets, as well as edit them. They are persisted to the UserDefaults plist as follows: <plist version="1.0"> <dict> <key>presets</key> <array> <dict> <key>name</key> <string>A preset</string> <key>value

vs own Plist

假装没事ソ 提交于 2019-12-23 03:26:23
问题 In my past projects I always made a NSObject-HelperClass which interacts with a selfmade-Plist. Now i hear I can use [NSUserDefaults standardUserDefaults] and have also my dictionary. So why should I use UserDefaults instead of my own NSObject which massages the plist? cheers endo 回答1: NSUserDefaults is a convenient way to store some preferences and the current state of the application (ex: "remember me" checkbox set to yes or no). You should only use it for this kind of data. You can also

Reading plist file. iOS Programming

我的梦境 提交于 2019-12-23 02:45:12
问题 I have this code and can't figure out what I'm doing wrong. As you can see in the code below I have a plist file called shifts.plist which is in my supporting files folder. Here is my plist structure. NSString *path = [[NSBundle mainBundle] pathForResource:@"shifts" ofType:@"plist"]; dictionary = [[NSMutableDictionary alloc]initWithContentsOfFile:path]; cell.textLabel.text = [secondTableInfo objectAtIndex:indexPath.row]; NSLog(@"%@",[[dictionary objectForKey:@"name"]objectAtIndex:0]); I would

Download plist from server

二次信任 提交于 2019-12-22 18:33:20
问题 Today I have an application that reads a plist site, but would it work like this: when you open the app it checks if the User already has the plist on device and if that is the latest version. If you have not or not it is the latest version of the server catches http://lab.vpgroup.com.br/aplicativos/teste-catalogo/lista.plist How could I do this? I have seen many questions here on stackoverflow, but none worked as I need. Thanks 回答1: you never want to block the UI. Downloading can take a long

iPhone long plist

廉价感情. 提交于 2019-12-22 16:41:28
问题 I have some data i want to add in to my app...about 650 categories (includes a name + id number), each with an average of 85 items (each with a name/id number). Will the iPhone support such a large plist? I want to first display the categories in a UITableView, when a category is selected I want to display all of the associated items. Having such a large plist, im not sure if the iPhone will lag when loading the items. At over 51,000 lines it seems like...it might. EDIT: The raw text file is

Write data to plist

雨燕双飞 提交于 2019-12-22 10:44:49
问题 I would like to read data from a plist, add some elements and the write the data to a plist.(update a plist). I want to have the plist hold an array of dictionaries, read this array into my app, add dictionaries and then write the array back to the plist. How is this done? Im also not sure where and how to create the plist on the apps first launch. or should it be placed in the bundle from the beginning? Another thing I am not sure about is if the plist dictionaries can hold e.g. CLLocations

Limit application capabilities in IOS to only work with Cell/WiFi data.

拜拜、爱过 提交于 2019-12-22 09:45:01
问题 I have searched all over StackOverFlow but did not find any answer on how to use Required Device Capabilities or UIRequiresPersistentWiFi . How do I set values in my application such that the app only works on cellular data/WiFi in the iPhone? Currently I have set the string WiFi property in the Required Device Capabilities Array according to iOSDeviceCompatibility. Is this the correct approach or should I set UIRequiresPersistentWiFi BOOL to YES ? 回答1: Based on the documentation, setting