Andrew
Andrew

Reputation: 1292

Why are Settings default values not showing in iPhone app?

I’m loading default values into the apps Settings using a Root.plist file. The values seem to load fine, and I can see them from Settings on the device.

However, the app itself doesn’t seem to see those values, it only sees the values that have been manually typed into the device (via Settings).

The values appear the same in Settings, whether defaults or device-entered. I use the same code (obviously) for loading the values in the app, whether they are defaults or device-entered.

Anyone see what I'm missing?

Upvotes: 1

Views: 323

Answers (1)

X Slash
X Slash

Reputation: 4131

Setting the default in Root.plist is quite misleading actually, it doesn't create default value. You have to register the defaults using

[NSUserDefaults standardUserDefaults] registerDefaults:aDictionaryHere];

aDictionaryHere is a NSDictionary object with the key and value you want to register as defaults, for example

[NSDictionary dictionaryWithObject:@"English" forKey:@"Language"];

This key and value will have to match whatever you set in your Root.plist

Upvotes: 1

Related Questions