This is my first stab at creating two targets within one project for iPhone and iPad.
My question is, if I save an array to NSUserDefaults, and the iPhone syncs with iTunes, and then I sync the iPad, will the iPad version have access to the array synced to it?
...
Trying programmatically do what the 'defaults write' command does in OS X. I can't seem to figure out how to get the correct preferences dictionary for the domain I'm looking for. I can get some preferences for the domains in the code below, but the preferences in question don't seem to be in the dict.
Why/How are they in the terminal...
Hello friends..
For my current development of iphone app, I want to implement history/favorite feature. After lots of googling I came to conclusion that 'NSUserDefaults' would work better in case of short data storage. But still I am not clear how to interact with NSUserDefaults....Can anyone refer any example or article to work out wit...
The Settings Bundle is supposed to be a pretty straight forward thing, but for some reason I'm not getting it to work.
In my settings bundle's Root.plist I'm using a PSToggleSwitchSpecifier and a PSTextFieldSpecifier. Both have Type, Title, Key, and DefaultValue. And it shows up properly when looking at it in the Settings on the iPod To...
[[NSUserDefaults standardUserDefaults] setObject:myArray forKey:@"myArray"];
I'm trying to figure out how to save and load an array using NSUser Defaults. I already have the NSCoding delegate methods defined, just need to know the actual commands to execute that will call those methods.
...
I saved an array using the following code:
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:myArray];
[[NSUserDefaults standardUserDefaults] setObject:data forKey:@"myArray"];
What is the code to load it back into memory?
...
I have an object. It has only two NSStrings as properties.
I created an array to hold several of these objects.
Do I need to use NSKeyedArchiver to save this array to disk, or can I just use NSUserDefaults?
...
Let's say I saved data to disk like this:
[[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:theArray] forKey:@"savedArray"];
How can I erase that from disk?
...
I made a class. This is the h file.
// MyClass.h
#import <Foundation/Foundation.h>
@interface MyClass : NSObject <NSCoding> {
NSString *string1;
NSString *string2;
}
@property (nonatomic, retain) NSString *string1;
@property (nonatomic, retain) NSString *string2;
@end
This is the m file.
// MyClass.m
#import "MyClass.h"...
I made a class. This is the h file.
// MyClass.h
#import <Foundation/Foundation.h>
@interface MyClass : NSObject <NSCoding> {
NSString *string1;
NSString *string2;
}
@property (nonatomic, retain) NSString *string1;
@property (nonatomic, retain) NSString *string2;
@end
This is the m file
// MyClass.m
#import "MyClass.h"
...
Hi there
I have this in my app delegate applicationDidFinishLaunching method:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if([defaults objectForKey:@"AcceptTC"] == nil){
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"NO" forKey:@"AcceptTC"];
[defaults registerDefaults:appDefaults];
}
an...
Im trying to send a float from one viewcontroller to another.
Ok Ive tried using NSUserDefaults to go about this. First I tested it with a string and it worked, but now I'm struggling to do the same with my float. Any help would be appreciated! :) Heres my code
In my firstviewcontroller.h file i have
IBOutlet UITextField *nameField;...
For some reason, since multitasking has arrived, NSUserDefaults seem to not save the settings to disk anymore every time the app closes.
This happens:
When a setting is changed in NSUserDefaults and home button gets pressed, home screen becomes visible. app is still running in background. Then I press twice the home button, and remove t...
I have noticed that the saving of NSUserDefaults takes a while.
How can I check if it has finished saving?
for example I do:
NSMutableArray *uld = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:@"testdata"]];
[uld addObject:teststring];
[[NSUserDefaults standardUserDefaults] setObject:uld forKey:@"t...
Is there anyway to save a URL with NSUserDefaults without setURL:forKey: that is only available to iOS 4.0 and later?
I am loading HTML files locally with fileURLWithPath, and it starts at an intro page and the user can click through to whatever. For now, everytime a user starts over it loads back default to intro.htm. I would like to b...
I currently have two UITextFields inside two corresponding UITableViewCells.
This is how it looks:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if...
When the root view controller of my application is loaded, I want to be able to check whether or not the users login credentials have been saved to NSUserDefaults.
Basically, when the user loads the application and he/she doesn't have her login credentials saved, a modalAlertView will be pushed and the user will be able to save their cr...
I'm querying rows from my sqlite database using Fetch and loading the results into a NSMutableArray myDataArray. What I want to do is to store the values in myDataArray into my application's preferences plist file. But when I run the code below I get the following error:
[NSUserDefaults setObject:forKey:]: Attempt to insert non-property...
Hello,
I am having a... strange problem.
I am adding an NSDictionary to an NSArray, then saving it to the defaults. When I check the object count of that key on the user defaults, it says the count is 0, but the array that's "on memory" has that object (so the count is 1).
The code, along with the output it gives is this:
(array is a...
I was able to save an NSMutableArray of custom objects to NSUserDefaults by implementing NSCoding in the custom class. However, now I want to save an NSMutableArray of these arrays. The compiler complains when I try to do this. How can this be done?
...