Mongrel Jedi
Mongrel Jedi

Reputation: 777

Xcode 9 iOS Simulator - Unable To Obtain Valid Process Handle

I have upgraded to Xcode 9, and the iOS Simulator for 10.3 and 11 are not working. All stock and my apps are force closing when trying to run.

Xcode Console errors like the following show when I try to run Calendar, Preferences etc. What does the "Unable to obtain valid process handle" mean?


Process handle (com.apple.Preferences, <BSProcessHandle: 0x7fe84552b8b0; Preferences:9270; valid: NO>) is invalid. Returning error {
    BKSProcessExitReason = 0;
    BKSProcessJobLabel = "UIKitApplication:com.apple.Preferences[0x90bf][6825]";
    NSLocalizedFailureReason = "Unable to obtain valid process handle";
}

[com.apple.Preferences] Bootstrap failed with error: <NSError: 0x600000846c60; domain: BKSProcessErrorDomain; code: 1 (bootstrap-failed); reason: "Unable to obtain valid process handle">

Bootstrapping failed for <FBApplicationProcess: 0x7ffae944f990; com.apple.Preferences; pid: -1> with error: Error Domain=BKSProcessErrorDomain Code=1 "Unable to bootstrap process with bundleID com.apple.Preferences" UserInfo={NSLocalizedFailureReason=Unable to obtain valid process handle, BKSProcessExitReason=0, BSErrorCodeDescription=bootstrap-failed, BKSProcessJobLabel=UIKitApplication:com.apple.Preferences[0x90bf][6825], NSLocalizedDescription=Unable to bootstrap process with bundleID com.apple.Preferences}

Process handle (com.apple.mobilecal, <BSProcessHandle: 0x7fe845525860; MobileCal:9363; valid: NO>) is invalid. Returning error {
    BKSProcessExitReason = 0;
    BKSProcessJobLabel = "UIKitApplication:com.apple.mobilecal[0xf53][6825]";
    NSLocalizedFailureReason = "Unable to obtain valid process handle";
}

[com.apple.mobilecal] Bootstrap failed with error: <NSError: 0x604000643ae0; domain: BKSProcessErrorDomain; code: 1 (bootstrap-failed); reason: "Unable to obtain valid process handle">

Bootstrapping failed for <FBApplicationProcess: 0x7ffaeb141220; com.apple.mobilecal; pid: -1> with error: Error Domain=BKSProcessErrorDomain Code=1 "Unable to bootstrap process with bundleID com.apple.mobilecal" UserInfo={NSLocalizedFailureReason=Unable to obtain valid process handle, BKSProcessExitReason=0, BSErrorCodeDescription=bootstrap-failed, BKSProcessJobLabel=UIKitApplication:com.apple.mobilecal[0xf53][6825], NSLocalizedDescription=Unable to bootstrap process with bundleID com.apple.mobilecal}

Unable to find framework using path: /System/Library/Frameworks/VideoSubscriberAccount.framework

I've tried it on iPhone X, iPhone 8/8+ and iPhone 6+ simulators with iOS 11 / 10.3.1, all with the same crashing result. If I try it on older iOS simulators such as iPhone 6+ iOS 9.2, then it runs fine.

If I try to launch it many times, i.e. 40 - 50 times for Safari or Calendar, sometimes that specific app may run, and once successfully ran, it'll remain so for the rest of the session (until I close the app at the task switcher, then same problem recurs). The same happens for my Xcode compiled app too.

My iMac 2009 has been running El Capitan and Xcode 8 fine all the while, and I just upgraded to High Sierra with Xcode 9.

I tried Xcode 9.1 Beta, but same problems persisted.

Please help, thanks.

Upvotes: 1

Views: 1245

Answers (1)

Mongrel Jedi
Mongrel Jedi

Reputation: 777

Thanks to @russbishop's suggestion of disabling 3rd party kernel extensions, I have found the culprit — One Periodic's Hands Off Firewall!

I unloaded the kext with this command:

kextunload -b com.metakine.handsoff.driver

And immediately all the stock apps in iOS Simulator can start perfectly fine. Note that you must unload the kext. Simply disabling the rules in Hands Off does not fix the problem.

However, I cannot "kextload" back the Hands Off driver once I am done to reactivate the firewall. A system reboot is needed.

I have reported this issue to Hands Off as well, and hopefully see a fix in the next release.

Thanks @JeremyHuddlestonSequoia for helping with the diagnosis too.

Upvotes: 2

Related Questions