问题
I just installed Xcode 6.0.1 (coming from Xcode 5.1.1) and tried to run my iOS app on iPhone 6 simulator for the first time. It builds and runs, but I cannot change its settings. I use NSUserDefaults
for my settings. Each time I change settings, go back to the list of settings and then select my app's settings again, they are set according to the default settings.
When I tried to figure out why this could happen I noticed that changing settings of the standard iOS app Maps does not work either. I cannot change the distance setting from miles to kilometers. This happens with fresh iOS Simulator settings (I "Reset Content and Settings" several times) when simulating iPhone 6 and iPhone 6 plus.
Any ideas?
回答1:
This is a known bug in iOS 8.0 in the simulator. The only workaround at this time is to set the preferences from the command line using the defaults command line tool.
defaults write ˜/Library/Developer/CoreSimulator/Devices/<UDID>/data/Containers/Data/Application/<App UUID>/Library/Preferences/...
You also need to find the relevant UDID.
回答2:
This appears to have been fixed in Xcode 6.1 so consider updating.
回答3:
This happened to me, too. It seems that the settings file is not saved at all.
˜/Library/Developer/CoreSimulator/Devices/[GUID]/data/Containers/Data/Application/[GUID]/Library/Preferences
is empty.
I've tried to use plist file from 7.1 simulator, but without any luck.
Downloading iOS 7.1 Simulator through XCode -> Preferences -> Download allowed me to save the settings, but that just for iOS 7.1.
来源:https://stackoverflow.com/questions/25933158/xcode-6-ios-simulator-does-not-remember-app-settings