plist

How do I read a value of a property list file key into a string for iphone app using Xcode

老子叫甜甜 提交于 2019-12-08 10:40:13
问题 I have a property list file "someFile.plist" and within the plist I have two rows "row1" and "row2" each with a string value that is either "Y" or "N" - If I want to check the "someFile.plist" file for "row2" to obtain the value of that row and read it into a string in objective c, how would I do that? I am coding for an iphone App using Xcode. 回答1: Load the .plist into a NSDictionary like: NSString *path = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"plist"]; NSDictionary

Search on Arrays inside Plist in Xcode

余生颓废 提交于 2019-12-08 10:20:24
问题 I'm developing an app that should search a string inside the Plist data and return a value that should prompt the user what kind of, say brand it is. For example, the user inputs "iPhone" in my text field and the app should return the brand of the product the user inputted after tapping the Go button below the text field. Inside my Products.plist, It contains arrays of brands with certain products that brand has. Example would be: Apple: iPhone, iPod, iPad, Mac Sony: PSP, PS3, Bravia, Xperia

iOS front camera only app

送分小仙女□ 提交于 2019-12-08 09:50:36
问题 I've had apps denied in the past for not specifying in the plist or something that the app will ONLY run properly on devices with 3g or devices with a compass, or with texting, etc. How do I specify that my app will ONLY run properly with devices that have a front camera (like Skype would have had to do) Thanks! 回答1: If you want your app to be used only on devices that have a front camera, then you can specify that by adding front-facing-camera to the app required capabilities. However, if

How to pull the data from plist to UIPickerView?

元气小坏坏 提交于 2019-12-08 09:18:14
问题 can please help to provide the tutorial on how to pull the data from plist to UIPickerView? 回答1: 回答2: it useful for u. pickerViewcontroller.h #import <UIKit/UIKit.h> #define kStateComponent 0 #define kZipComponent 1 @interface PickerViewController : UIViewController <UIPickerViewDataSource,UIPickerViewDelegate>{ IBOutlet UIPickerView *dpicker; NSDictionary *stateZip; NSArray *states; NSArray *zips; } @property (nonatomic,retain) UIPickerView *dpicker; @property (nonatomic,retain) NSDictionary

performance of nspropertylistserialization vs nsjsonserialization

爱⌒轻易说出口 提交于 2019-12-08 07:05:35
I'm considering making a switch from serializing data from my web service endpoint as JSON to a binary property list. I'm unserializing on Cocoa. Has anyone who has used both NSPropertyListSerialization and NSJSONSerialization noticed a difference in parsing times? I'm curious as I've read before that there's a noticeable difference—see this blog post (in the Under the Hood section) for an example by Hipmunk. Also interesting to me if there's a noticeable difference between NSJSONSerialization and external libraries like JSONKit or TouchJSON . I can say that NSJSONSerialization is faster than

False order when reading Dictionary from PList

∥☆過路亽.° 提交于 2019-12-08 06:01:34
问题 I have a plist from which i am trying to access its animations in sequence (as defined in the PList) but when I store it in NSDictionary and then try to play animation one by one it is not playing them in sequence. e.g, int index = 0; [self playAnimation:[animTypes objectAtIndex:index++]]; [self playAnimation:[animTypes objectAtIndex:index++]]; This is the code of my Plist: <plist version="1.0"> <dict> <key>Boy</key> <dict> <key>Enter</key> <dict> <key>disabled</key> <false/> <key>halfCycle<

Load data from a plist to two TableViews

笑着哭i 提交于 2019-12-08 05:15:51
问题 I am having some trouble to load some data from my property list. Take a look… This is my directory.plist : I wanna show all of this, right here on Main.storyboard : But the keys Position e Name will appear on the first TableViewController and the keys Functionary , ImageFace and Phone have to appear on the second TableViewController . To do this, I made this: Added to AppDelegate the following: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:

Saving CLLocation error: Mutating method sent to immutable object

爱⌒轻易说出口 提交于 2019-12-08 05:06:43
问题 I have read the other related questions, but I am stuck. I am trying to save the last known location into a plist for later use. Here is the error message I am receiving: * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object' Here is my code: var plist = NSDictionary(contentsOfFile: NSBundle.mainBundle().pathForResource("Config", ofType: "plist")) var dataToStore =

how to edit a plist programmatically in xcode 5 iOS 7?

耗尽温柔 提交于 2019-12-07 18:52:11
问题 how can I edit or change a value string from: in this plist I need change or Set "NO" in Enabled Value from Item 2, I see a lot examples, but not working, or are deprecated, or don't use ARC, any idea or example code? please help guys EDIT#1: I try this (not work) NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]; path = [path stringByAppendingPathComponent:@"List.plist"]; NSFileManager *fileManager = [NSFileManager defaultManager];

Saving CLLocation error: Mutating method sent to immutable object

限于喜欢 提交于 2019-12-07 17:57:31
I have read the other related questions, but I am stuck. I am trying to save the last known location into a plist for later use. Here is the error message I am receiving: * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object' Here is my code: var plist = NSDictionary(contentsOfFile: NSBundle.mainBundle().pathForResource("Config", ofType: "plist")) var dataToStore = NSKeyedArchiver.archivedDataWithRootObject(lastKnownLocation) plist.setValue(dataToStore, forKey: "location") The