plist

Writing a new set of data to Plist instead of overwriting it

你。 提交于 2019-11-30 16:33:10
I'm trying to get a plist to store multiple sets of data, but each time I save (using a button from an ActionSheet), it overwrites the previous set. I want to add multiple 'friends' and their data. I'm not too keen on using Core Data, so I'm wondering how you can do it with a Plist. Here is the code for the save button: NSMutableDictionary *friend = [[NSMutableDictionary alloc] init]; NSMutableDictionary *array = [[NSMutableDictionary alloc]init]; [array setObject:friendName.text forKey:@"Name"]; [array setObject:friendPhone.text forKey:@"Phone Number"]; [array setObject:friendEmail.text

PList to JSON converter and processing JSON response on client [closed]

陌路散爱 提交于 2019-11-30 16:27:32
Is there any tool which can convert my PLIST into JSON. I do not have much idea on JSON formatting. I have a PLIST for which I want an equivalent JSON file. Also, how do we process JSON response on iOS client using objective C. I have worked with PList response so far. schellack Others have previously asked about converting .plist files to json here . Once you have your data in a json format, you can then use Apple's NSJSONSerialization class, documented here : You use the NSJSONSerialization class to convert JSON to Foundation objects and convert Foundation objects to JSON. There are other

Reading a plist into core data - NSDictionary within NSDictionary

橙三吉。 提交于 2019-11-30 15:57:12
问题 I have a plist of values I want to read into Core Data. I can read in the "top level," but along with strings and numbers, each item also contains dictionaries. I am having trouble getting the syntax right to read those. Garden and Plant are my 2 Core Data Entities. Both Garden and Plant are NSDictionaries containing data about themselves. Gardens can contain many plants, and specific plants can be in many gardens, so there is a many to many relationship. This much works: I use a plist

Retrieve data from plist

拈花ヽ惹草 提交于 2019-11-30 15:30:02
问题 I have a plist and inside that an array and then set of dictionary elements? How can I retrieve data from the plist to my array? How can I get category names in one array? 回答1: Objective-C // Read plist from bundle and get Root Dictionary out of it NSDictionary *dictRoot = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"data" ofType:@"plist"]]; // Your dictionary contains an array of dictionary // Now pull an Array out of it. NSArray *arrayList = [NSArray

How can I add an Array to a Plist using PlistBuddy?

人走茶凉 提交于 2019-11-30 15:15:21
问题 This question is a Sub-Question/Alternative Way to approach what I am trying to do via this question: How can I use PListBuddy to copy an entry from one file to another? I want to copy an Entry from Plist File A to Plist File B using PlistBuddy through an XCode Build Script, using Bash/Shell. By doing this, I cannot use PlistBuddy's "Copy" function. I must copy each individual entry over with all of it's elements, since you cannot add/set dictionaries, but must interact with PlistBuddy via

Modifying Info.plist's CFBundleVersion in Xcode 5 with Asset Library enabled

流过昼夜 提交于 2019-11-30 14:43:36
问题 With Xcode 5's new Asset Library, adding images and organizing them has never been easier. However, it seems as if it has broken some scripts I use for creating builds. I have a script within my Run Script Phase that sets the CFBundleVersion to be the current timestamp within the plist. In the script, I execute this statement: /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $timestamp" $BUILT_PRODUCTS_DIR/$INFOPLIST_PATH However, when this gets executed, the following statement displays: Set

How to change cordova-camera-plugin language in iOS?

ε祈祈猫儿з 提交于 2019-11-30 13:55:13
I wish to change the cordova-camera-plugin language. Apparently it is dependent on a variety of things. My development environment is Tools for Cordova in Visual Studio 2015. It is unlikely that it matters but I am using the Ionic framework in my app. We build our app for iOS on a MacBook Pro laptop running Xcode 7. The device I am testing on is an Ipad running iOS 9.1 with Dutch as first language and english as second. In my app when you open the camera you have a few options such as Cancel , Use Photo and Retake Photo . The things I have done to try and make the plugin localized to the Dutch

Detecting the first ever run of an app

瘦欲@ 提交于 2019-11-30 13:28:11
问题 I am creating an app in which I have to create a plist when the app launches for the first time. I'm later going to use the plist to store details a user later inputs. How can I detect the first launch of the app? I was experimenting with NSUserDefaults but I think I'm doing something wrong. 回答1: You can do this with NSUserDefaults. But be careful with the Version Number. Do the following: NSString *bundleVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *

Modifying Info.plist's CFBundleVersion in Xcode 5 with Asset Library enabled

ⅰ亾dé卋堺 提交于 2019-11-30 11:36:13
With Xcode 5's new Asset Library, adding images and organizing them has never been easier. However, it seems as if it has broken some scripts I use for creating builds. I have a script within my Run Script Phase that sets the CFBundleVersion to be the current timestamp within the plist. In the script, I execute this statement: /usr/libexec/PlistBuddy -c "Set :CFBundleVersion $timestamp" $BUILT_PRODUCTS_DIR/$INFOPLIST_PATH However, when this gets executed, the following statement displays: Set: Entry, ":CFBundleVersion", Does Not Exist File Doesn't Exist, Will Create: /Users/SpacePyro/Library

How can I use PlistBuddy to access an element of PreferencesSpecified by its property?

江枫思渺然 提交于 2019-11-30 11:33:47
问题 At the moment I'm using this code /usr/libexec/PlistBuddy -c "Set PreferenceSpecifiers:1:DefaultValue $productVersion" "Test/Settings.bundle/Root.plist" in script part of build phase to put product version in a read only field of the application settings. That field has position 1 (starting from 0) of the preferences array. I'm asking if it's possibile to use something more robust that 1 to access that field since position can be accidentally changed during development by me or by other