Xcode 4.2.1: UIAutomation setPreferencesValueForKey not mapped to NSUserDefault
| Originator: | contact | ||
| Number: | rdar://10648620 | Date Originated: | 05-Jan-2012 06:49 PM |
| Status: | Closed | Resolved: | |
| Product: | Xcode | Product Version: | 4.2.1 |
| Classification: | Serious | Reproducible: | Always |
Summary:
In UIAutomation script, one can set setPreferencesValueForKey on UIATarget.localTarget.frontMostApp to change the preferences of an app. Doing this doesn't produce result while inspecing NSUserDefaults in the app.
Steps to Reproduce:
1. write a UIAutomation test script
2.
In the script, do the following
UIATarget.localTarget().frontMostApp().setPreferencesValueForKey("aValue", "someKey");
3.
In the app, log the following
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults] ;
NSString *aValue = [userDefaults objectForKey:@"someKey"];
NSLog("aValue=%@", aValue);
Expected Results:
The UIAutomation should set the preferences object of NSUserDefaults
Actual Results:
The UIAutomation doesn't set the preferences object of NSUserDefaults
Regression:
Notes:
On the iOS Simulator, preferences of an app are stored in ~/Library/Application Support/iPhone Simulator/5.0/Applications/xxxxxxxxx/Library/Preferences/com.mycompany.monapp.plist
The UIAutomation seems to stored the result in
~/Library/Application Support/iPhone Simulator/5.0/Library/Preferences/com.mycompany.monapp.plist
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
I am also seeing this issue when running my tests from the simulator. However, this is working for me on device. When inspecting the device with iExplorer, the preference was saved in the right plist location.