Because the settings bundle resides inside your app's bundle, you cannot change it at runtime, only at compile-time.
You can, however, use NSUserDefaults
to set the value at runtime, and the settings application will automatically reflect this. It will be saved elsewhere, though. You can just read it back the same way as you would do with the settings bundle, also through NSUserDefaults
.
Note that you shouldn't read from the settings bundle directly, as it makes no sense. You should always fetch and set user defaults using NSUserDefaults
. When the user makes a change in the settings application, NSUserDefaults
will reflect this automatically. They will always be kept in sync.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…