문제

I have an app where Location is important. Currently I have a multi-value setting in the settings bundle where I have 5 locations defined. The problem with this approach is that the settings bundle is static - i.e. I cannot update that from a JSON list on my server as far as I know.

I want to update the location list from a dynamic list on the server.

I have looked at InAppSettingsKit but this also uses the standard settings bundles. Is it possible to use InAppSettingsKit to import settings updates dynamically from a remote list.

Are there other ways to do what I am trying to do?

도움이 되었습니까?

해결책

You won't be able to change the list dynamically with regards to Settings.app. Settings.app always uses the static schema plist from your app bundle. (You could resort to a freeform text field but that probably doesn't catch your case.)

With InAppSettingsKit, you can accomplish that but you have to do some extra work: For the dynamic parts, you'll want to use a custom view controller, e.g. a table view controller.

다른 팁

Best way for you handle this is storing the multi-values in the NSUserDefaults and start using them. In this method, you will be able to update the values as well as it will be persistent across multiple sessions.

Edit (answers comment):

Saving it to user defaults.

NSDictionary *appDefaults =  [NSDictionary dictionaryWithObjectsAndKeys:
                              @"your Object", "Your Key"
                              nil];

[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
[[NSUserDefaults standardUserDefaults] synchronize];

Retriving it:

[[NSUserDefaults standardUserDefaults] integerForKey:@"Your Key"];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top