0
看來事情錯了,我不能存儲或在我的代碼NSUserDefaults的閱讀:我不能存儲或讀取NSUserDefaults的
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray * defaultKeys = [NSArray arrayWithObjects:
@"FirstViewComposer",
@"ProfileNickname",
@"ProfileGender",
@"ProfileDateOfBirth",
@"ProfileFavoriteColor",
@"ProfileHeight",
nil];
NSArray * defaultValues = [NSArray arrayWithObjects:
@"YES",
@"Me",
@"Male",
@"08 Dec 1983"
@"Red",
@"183",
nil];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:defaultValues forKey:defaultKeys];
[defaults registerDefaults:appDefaults];
NSLog(@"%@", [defaults stringForKey:@"FirstViewComposer"]); //null
感謝
UPDATE: 現在的我中號同步,實際上它們被存儲,但我可能無法正確檢索它們:
2011-08-23 17:16:06.932 Sansnuage[1404:b603] defaults: (
(
en,
fr,
de,
ja,
nl,
it,
es,
pt,
"pt-PT",
da,
fi,
nb,
sv,
ko,
"zh-Hans",
"zh-Hant",
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
"en-GB",
ca,
hu,
vi
),
1,
(
YES,
Me,
Male,
"08 Dec 1983Red",
183
),
"en_US",
(
"[email protected]=US;sw=QWERTY"
),
(
en,
fr,
de,
ja,
nl,
it,
es,
pt,
"pt-PT",
da,
fi,
nb,
sv,
ko,
"zh-Hans",
"zh-Hant",
ru,
pl,
tr,
uk,
ar,
hr,
cs,
el,
he,
ro,
sk,
th,
id,
"en-GB",
ca,
hu,
vi
),
macintosh
)
好,謝謝,我已經更新了我的問題 – aneuryzm
我已經更新了我的回答太:-) – gsempe