REGRESSION UIAApplication.preferencesValueForKey() does not work iOS 8 GM

Originator:joshuajmoody
Number:rdar://18310483 Date Originated:11-Sep-2014 10:38 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6 GM
Classification:Serious Bug Reproducible:Always
 
Summary:
If I set a value in NSUserDefaults in the UIApplicationDelegate, I expect to be able to launch the app with Instruments.app and inspect that value in UIAutomation.

> preferencesValueForKey
>> Gets the value of a specified app user preference.

This works in iOS 6 and iOS 7.

It works on the iOS 6 - 8 Simulators.

It does not work on iOS GM.

Possibly related to:

* rdar://18296714
* rdar://17821465
* rdar://15530604

Steps to Reproduce:
### To Reproduce

**Requires**

* iOS 8 GM device
* The source code of an iOS app.
* Instruments 6 GM

1.  In the UIApplicationDelegete application:didFinishLaunchingWithOptions: method.

```
[[NSUserDefaults standardUserDefaults] setObject:@"Hey!" forKey:@"com.example.set-in-uiapplication-delegate"];
[[NSUserDefaults standardUserDefaults] synchronize];

// Optionally log the NSUserDefaults to visually confirm that the value has been set.
return YES;
```

2. Build and run the application, targeting the iOS 8 GM device
3. Stop the run from Xcode.
4. Launch Instruments 6 GM and select the Automation template.
5. Target the iOS 8 GM device and the app you just built and ran.
6. Execute this script

```
var target = UIATarget.localTarget();
var valueSetInAppDelegate  = target.frontMostApp().preferencesValueForKey("com.example.set-in-uiapplication-delegate");
if (valueSetInAppDelegate == "Hey!") {
    UIALogger.logPass("The value I set in the app delegate was '" + valueSetInAppDelegate + "'");
} else {
    UIALogger.logFail("Expected to see 'Hey!' but found '" + valueSetInAppDelegate + "'");
}
```

Expected Results:

### Expected

To be able to inspect the value I set in the  application:didFinishLaunchingWithOptions: method.

Actual Results:
### Found

* Works on iOS 6 - 8 on simulators.
* Works on iOS 6 - 7 on devices.

On iOS 8 GM

```
Expected to see 'Hey!' but found 'null'
```


Version:

OS X 10.9.4 (13E28)
Xcode6 GM
instruments, version 6.0 (56156)
iOS 8 GM

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!