Xcode 9 iOS Simulator - Unable To Obtain Valid Process Handle - ios

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.

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.

Related

Xcode Error: LSPrefs: could not find untranslocated node for <FSNode 0x600001df5960>

Context
I have an App designed for iPhone and iPad and would like to run it on a Apple Silicon Chip as introduced with macOS Ventura.
However, every time I launch it, the App instantly crashes and I get the following Error Description while it works perfectly fine when running on iPhone or iPad. The same happens when switching to Mac Catalyst.
Error: error: memory read failed for 0x0 Thread 5: EXC_BAD_ACCESS (code=1, address=0x0)
Description: [default] LSPrefs: could not find untranslocated node for <FSNode 0x600001df5960> { isDir = ?, path = '/private/var/folders/gj/zn74hv6951l5_jstmxf08mhh0000gn/X/7CE2EC44-AD13-5826-9A1D-56FC60C9B52D/d/Wrapper/AppName.app' }, proceeding on the assumption it is not translocated: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"
Question
What causes the error and how can I run the App on Apple Silicon?
Thanks a lot for your help!

How to debug "Error acquiring assertion" with CloudKit database subscription for mac-catalyst app?

I have a working native iPhone/iPad app that I’m now trying to also do as a Mac Catalyst app. Everything seems to working, except when I enter something on the iOS version, it "breaks" the macOS version – I’m using CloudKit and CloudKit subscriptions to listen to changes in database.
I get this into the log 3 times:
2020-04-25 09:58:35.612887+0300 MyApp[2871:206093] [assertion] Error acquiring assertion: <NSError: 0x600000d4cb40; domain: RBSAssertionErrorDomain; code: 2; reason: "Specified target process does not exist">
2020-04-25 09:58:35.613919+0300 MyApp[2871:206093] [assertion] Error acquiring assertion: <NSError: 0x600000d4d290; domain: RBSAssertionErrorDomain; code: 2; reason: "Specified target process does not exist">
2020-04-25 09:58:35.615102+0300 MyApp[2871:206093] [assertion] Error acquiring assertion: <NSError: 0x600000d4de00; domain: RBSAssertionErrorDomain; code: 2; reason: "Specified target process does not exist">
The behaviour is really strange. The macOS version doesn’t actually crash, but the main window disappears and I have to rebuild it in XCode the run it again. I’ve tried adding breakpoints etc to the notifications flow, but there’s nothing that catches so I’m really stumped. None of the usual application methods are called when the notification is received. The same problem appears in debug mode, both with simulator and device, and also in production.
Really hoping to get some pointers, where/how to debug this kind of a problem. I’ve checked the system logs and cannot find anything there either.
Just ran into this myself, and eventually figured it out: you probably have more than one instance of the app (with that bundle ID) on your machine, and the push notification service is trying to spin up the wrong binary to deliver the notifications.
Since Catalyst apps get nuked if they try to open multiple instances, this background launch kills the app you're running in the debugger.
In my case, I had the App Store version of the app installed in /Applications (before I started adding CloudKit), and my current dev binary in my Xcode build root.
Hope that helps!

Xcode: iOS app suddenly always crashes on launch

I created a quite simple app that can receive push notifications and display content. This is working without any problems since month.
Since yesterday the app suddenly crashes every time I want to launch it.
I'm using an iPhone 8 Plus with iOS 12.4.1. Restarting the app, hard and soft reset of the iPhone didn't help.
The console says the following:
fehler 07:37:35.510970 +0200 assertiond Unable to obtain a task name
port right for pid 542: (os/kern) failure (0x5)
fehler 07:37:35.511100 +0200 assertiond Failed to start job with error
{
description = "Unable to get valid task name port right for pid 542";
failureReason = "The process failed to exec";
recoverySuggestion = "Consult /var/log/com.apple.xpc.launchd/launchd.log for more information"; }
fehler 07:37:35.511894 +0200 SpringBoard [MyCompany.MyApp] Bootstrap
failed with error:
fehler 07:37:35.512091 +0200 SpringBoard Bootstrapping failed for
with
error: Error Domain=BKSProcessErrorDomain Code=1 "Unable to bootstrap
process with bundleID MyCompany.MyApp"
UserInfo={NSLocalizedDescription=Unable to bootstrap process with
bundleID MyCompany.MyApp, BKSProcessExitReason=0,
NSLocalizedFailureReason=Failed to start job,
NSUnderlyingError=0x28146e760 {Error Domain=NSPOSIXErrorDomain Code=3
"No such process" UserInfo={NSLocalizedFailureReason=The process
failed to exec, NSLocalizedRecoverySuggestion=Consult
/var/log/com.apple.xpc.launchd/launchd.log for more information,
NSLocalizedDescription=Unable to get valid task name port right for
pid 542}}, BSErrorCodeDescription=bootstrap-failed}
Does anybody have an idea why my app is suddenly crashing?
It might be happening if the developer certificate you used to create this app has been revoked or another app (still in development mode) with same bundle identifier is using your developer certificates. It happens when we build apps for testing purpose with free developer account which shares the certificate identities.
I had the same problem on my iPhone. It stopped working after a few days, so I checked around to see if I could find an answer. I found this, and it worked for me:
"Without enrolling in the Apple Developer Program, your app will only
last for 7 days on your device. After that, you’ll have to re-deploy
it to your device via Xcode. If you’re enrolled in the Apple Developer
Program, you won’t have this inconvenience."
I know it doesn't apply to the original question since he says he has a developer license, but it would apply to many others who don't pay for a license and if your license have expired.
I'm not sure if it's allowed to post a link to where I found the question, so just take it away if that's the case, but I do like to refer to where I got it from, when it's not me. https://codewithchris.com/deploy-your-app-on-an-iphone/

"Over The Air" iOS App won't be complete download

I've been trying to release a new version of some iOS App (developed with React Native) through the "Over The Air" way. I do have an Entreprise account. Also, I've done this before with the same App. It is the first time this fails.
The download of the app stops and looks like
I've been investigating a lot and here are some informations I can give:
XCode: 10.1
React Native: 0.57.5
Deployment Target: 9.3
I recreated my certificate & provisioning profile. My signing profile looks like which looks valid to me.
I'm downloading the app via a normal web page and the download link looks like this:
<a href="itms-services://?action=download-manifest&url=https://example.com/path/to/the/manifest.plist">
Download iOS
</a>
I'd like to release a build with an App Thinning All compatible device variants. The manifest looks normal to me but there is something that I question myself with. Prior to this release, in the manifest, the generated binaries looked like this: MyApp-iPhone%207%20Plus-etc.ipa. Now, since I updated XCode (from 10 to 10.1 if my memories are good) they look like this: MyApp-0AB530E1-7309-4293-B4B6-C0AD90662766.ipa.
I also verified the App URL, the Display Image URL and the Full Size Image URL and the three of them are valid.
Finally I checked the logs during the failing installation by going into Window -> Devices and Simulators -> Open Console -> Errors and Failures. Here are all the logs I could get telling me the installation failed. I've donc a couple research on Google but couldn't find nothing.
[PlaceholderUtility]: Failed artwork for bundleID: My.Bundle.Identifier error: Error Domain=SSErrorDomain Code=3 "Connexion à l’iTunes Store impossible" UserInfo={NSLocalizedDescription=Connexion à l’iTunes Store impossible}
[PlaceholderUtility]: Failed to load placeholder artwork for bundleID: My.Bundle.Identifier error: Error Domain=SSErrorDomain Code=3 "Connexion à l’iTunes Store impossible" UserInfo={NSLocalizedDescription=Connexion à l’iTunes Store impossible}
[ODRBackgroundMaintenance]: Cancelling maintenance operations.
[ODRLaunchServicesObserver]: Application My.Bundle.Identifier is invalid, ignoring the install notification from LaunchServicesLaunchServices reports My.Bundle.Identifier is not installed
Cannot generate canonicalExecutablePath for app <private> with no bundleExecutable set
LaunchServices reports My.Bundle.Identifier is not installed
asked question: p = <private>, q = <private>, e = 9 [<private>]
7 lines of: LaunchServices observer: Apps Failed be installed: <private>
Installation failed for <private>
8 lines of: LaunchServices observer: Apps Failed be installed: <private>
Applications did fail to install: ("<LSApplicationProxy: 0x10f438230> My.Bundle.Identifier file:///private/var/containers/Bundle/Application/SOME_ID/MyApp.app <My.Bundle.Identifier <placeholder >:1>") (appInfos: (null))
LaunchServices observer: Apps Failed be installed: <private>
[LaunchServicesObserver]: Coordinator is already being observed: <IXInitiatingAppInstallCoordinator<0x100ef46f0> identifier:My.Bundle.Identifier uuid:SOME_UUID creator:App Store state:IXAppCoordinationStateErrorOccurred>
[CoordinatorStore]: <IXInitiatingAppInstallCoordinator<0x103e13ba0> identifier:My.Bundle.Identifier uuid:SOME_UUID creator:App Store state:IXAppCoordinationStateErrorOccurred> with UUID SOME_UUID was canceled with reason: Error Domain=IXUserPresentableErrorDomain Code=1 "This app could not be installed at this time." UserInfo={NSLocalizedDescription=This app could not be installed at this time., NSLocalizedFailureReason=Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.RAz5m2/extracted/Payload/MyApp.app : 0xe800801c (No code signature found.), NSLocalizedRecoverySuggestion=Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.RAz5m2/extracted/Payload/MyApp.app : 0xe800801c (No code signature found.), NSUnderlyingError=0x103eb7a90 {Error Domain=MIInstallerErrorDomain Code=13 "Failed to verify code signature of /private/var/insta
!B21:My.Bundle.Identifier,J:-7761288138928876906#[<private>]: Fail temporarily for error: Error Domain=IXUserPresentableErrorDomain Code=1 UserInfo={NSLocalizedDescription=<private>, NSLocalizedFailureReason=<private>, NSLocalizedRecoverySuggestion=<private>, NSUnderlyingError=0x103eb7a90 {Error Domain=MIInstallerErrorDomain Code=13 UserInfo={NSLocalizedDescription=<private>, LegacyErrorString=<private>, SourceFileLine=199, LibMISErrorNumber=-402620388, FunctionName=<private>}}}
[ProgressCache]: No progress exists for: My.Bundle.Identifier trying to begin anyway
Thanks in advance for the help.
Feel free to ask me questions for some infos I might have forgotten
Downgrading to XCode 10.0 fixed it.
As mentionned in this question, it seems that there is an issue with XCode 10.1 for this kind of build

How to investigate iOS crash with error NSOSStatusErrorDomain Code=-50 "query missing class name"

Our app, released via TestFlight, is currently experiencing crashes for a small number of users, and the crash is very difficult to investigate. It happens on iOS 9 and 9.1, and we've seen it on several different iPhones. We've tested all these devices and OS versions so that doesn't appear to be the issue.
To debug the issue I've tried to check the device logs, and here is all we get:
securityd[93] <Error>: securityd_xpc_dictionary_handler Roger[1287] copy_matching Error Domain=NSOSStatusErrorDomain Code=-50 "query missing class name" UserInfo={NSDescription=query missing class name}
Roger[1287] <Error>: SecOSStatusWith error:[-50] Error Domain=NSOSStatusErrorDomain Code=-50 "query missing class name" UserInfo={NSDescription=query missing class name}
SpringBoard[58] <Warning>: HW kbd: Failed to set (null) as keyboard focus
com.apple.xpc.launchd[1] (UIKitApplication:im.rgr.RogerApp[0x24fe][1287]) <Notice>: Service exited due to signal: Trace/BPT trap: 5
diagnosticd[84] <Error>: unable to find offset 0x99c5ba5c in shared cache for arch 'arm64'
SpringBoard[58] <Warning>: Application 'UIKitApplication:im.rgr.RogerApp[0x24fe]' crashed.
UserEventAgent[26] <Warning>: 2808550521498: id=im.rgr.RogerApp pid=1287, state=0
Once I try to run the app via Xcode with Debug or Production (exact same code as what was released) the error no longer happens. So it only seems to happen specifically when the app is released via TestFlight.
Does anyone have any idea how to debug this issue?
Just in case this helps, I saw this error in the logs when trying to open an app signed with an Enterprise provisioning profile. I did not see the usual warning about trying to open an untrusted app; I have no idea why.
The fix was to go into Settings -> General -> Device Management (or Profiles & Device Management), and then under the Enterprise apps section, select the organisation and on the next screen choose to trust the profile. Documented in https://support.apple.com/en-us/HT204460
This issue turned out to be due to a framework accidentally being marked as required instead of optional, which would crash iOS 8 devices. (We originally thought it was happening on iOS 9+ devices as well, but it turned out it was iOS 8.4.)
Here's a screenshot of the corrected settings:

Resources