landonf/simlaunch — Issue #8: Launcher fails with iOS Simulator from Xcode 4.3 GM
Author: chucks
Created: 2012-02-16 21:20:49+00:00
State: open

At present, iOS apps bundled with simlaunch won't successfully launch if the user has Xcode 4.3 GM installed. This appears to be for two separate reasons...both of which appear to be related to Apple moving the various Xcode-related tools such as iOS Simulator to be located directly inside the Xcode bundle.

- PLSimulatorDiscovery searches for "iPhoneSimulator.platform" directories using Spotlight, and thus doesn't find the new platform directory that is inside the Xcode bundle. I have tested a fix for this where if Spotlight fails to find the iPhone Simulator. platform directory, I'll also look directly where Xcode 4.3 would locate the file "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform"

However, even if I fix this, there is a second problem.

- When PLSimulatorPlatform goes to load iPhoneSimulatorRemoteClient.framework, the load will fail because it can't find a dependant private framework. The framework exists, but it has been moved to a different location, and is also inside Xcode's bundle.

console log:
```
2/16/12 2:24:07.963 PM Launcher: Failed to load iPhoneSimulatorRemoteClient framework: Error Domain=NSCocoaErrorDomain Code=3587 "The bundle “iPhoneSimulatorRemoteClient” couldn’t be loaded because it is damaged or missing necessary resources." (dlopen_preflight(/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/iPhoneSimulatorRemoteClient): Library not loaded: @rpath/DevToolsFoundation.framework/Versions/A/DevToolsFoundation
Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/iPhoneSimulatorRemoteClient
Reason: image not found) UserInfo=0x400454f00 {NSLocalizedFailureReason=The bundle is damaged or missing necessary resources., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSFilePath=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/iPhoneSimulatorRemoteClient, NSDebugDescription=dlopen_preflight(/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/iPhoneSimulatorRemoteClient): Library not loaded: @rpath/DevToolsFoundation.framework/Versions/A/DevToolsFoundation
Referenced from: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/iPhoneSimulatorRemoteClient
Reason: image not found, NSBundlePath=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework, NSLocalizedDescription=The bundle “iPhoneSimulatorRemoteClient” couldn’t be loaded because it is damaged or missing necessary resources.}
```

In Xcode 4.2, DevToolsFoundation.framework was located at:
```
/Developer/Library/PrivateFrameworks
```

but in Xcode 4.3, it is located at:

```
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks
```

If I examine iPhoneSimulatorRemoteClient.framework in MacDependency, it also reports that it can't resolve the reference to DevToolsFoundation.framework.

Is there a problem with the Xcode 4.3 build of the private framework, or is there some build setting that could be tweaked in Launcher to search in additional locations for DevToolsFoundation?