nsuserdefaults

NSUserDefault's registerUserDefaults doesn't work?

Hey guys, My code is as follows: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], @"show_outer_reference_circle_preference", ...

Preset NSUserDefaults

I thought I read some where that I could include a NSUserDefaults file with a cocoa app. I cannot seem to find how to do that. I know I could just create on first app launch but I dont want to do that just yet... ...

Saving NSMutableArray to NSUserDefaults using NSKeyedArchiver

Hi, I'm having trouble retrieving a saved NSMutableArray containing a custom object. The app crashes and the console reports http://pastie.org/1226822. Here is my objects .h file http://pastie.org/1226823. Here is my objects .m file http://pastie.org/1226826. Here is how I save my data http://pastie.org/1226830. Here is how I retrieve my...

iPhone App works in simulator but not on device (NSUserDefaults)

Hi! I have some code, which works perfect in the simulator, but i cant run it on a real iPhone device and i dont get the reason: - (void)loadView { self.title = @"Optionen"; [super loadView]; } - (void)viewDidLoad { [super viewDidLoad]; NSMutableArray *strArray = [NSMutableArray new]; NSUserDefaults *prefs = [NSUserDefaults ...

How to test with NSUserDefaults?

Hello! In most of my classes that work with defaults I make the defaults object settable: @property(retain) NSUserDefaults *defaults; This is supposed to make testing easier: // In a nearby test class: - (void) setUp { [super setUp]; NSUserDefaults *isolatedDefaults = [[NSUserDefaults alloc] init]; [someObjectBeingTested ...

NSUserDefaults synchronize does not work when synchonizing archived data

I have a Mutable Array of objects, NSStrings, NSArrays, NSDictionaries, NSNumbers. These I archive this array and add it to NSUserDefaults without any problem, however when I call synchronize the method returns NO. Code: [[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:statusUpdates] forKey:t...

Cocoa Touch retain object returned from NSUserDefaults?

I have a NSArray object retrieved from the standard user defaults object, [NSUSerDefaults standardUserDefaults]. I want to save this array as a member variable of another object and use it for the lifetime of this object. I'm not sure if the array from NSUserDefaults is an autorelease object. Should I retain the array? ...

Retrieve Int from NSUserDefaults MultiValue

I would like to retrieve an Int value from NSUserDefaults, but it always comes up as 0. This is how my settings bundle looks: Type: String: PSMultiValueSpecifier Title: String: Timer Key: String: timerValue DefaultValue: Number: 4 Titles: Array: 5 Number Items 1-5 Values: Array: 5 Number It...

NSArrayController -(selected object)-> NSUserDefaults

I have created a preference pane that allows the user to select a QTCaptureDevice. In Interface Builder, I bind a KVC-compliant method in my model class that retrieves an NSArray of QTCaptureDevices to an NSArrayController, which is in turn bound to an NSPopupButton. This all works; the list of QTCaptureDevices appears in my NSPopupBut...

Use NSUserDefaults to get to a certain position in a UIScrollView

I have an ebook style iPhone app that allows users to read a book. I have it setup so that when they leave the app, it remembers what page they were on, but not the exact spot on the page (the page can scroll quite a bit). I am using NSUserDefaults to get me back to the page, I was wondering though if anyone had any ideas about how I mi...

saving/reading text

Hi, I have to save about 1kb of text. The text is not updated very often (about once a month). But is read once every time the app is started. Would saving it to NSUserDefaults slow down the reading/writing from/to NSUserDefault? Would it be better to save it to a text file in the documents folder? Thanks in advance! ...