Xcode not opening after updating to MacOS Catalina [duplicate] - ios

This question already has answers here:
MobileDevice.pkg untrusted, cannot open Xcode after OS X update
(11 answers)
Closed 3 years ago.
I updated to MacOS Catalina and now my Xcode is not opening. I get this prompt:
Which leads to this error after getting root access:
There is a huge log but the key errors are:
2019-11-04 12:39:48+05 tk_lpt_0141_wifi Xcode[1214]: Package:
PKLeopardPackage
Failed to verify with error: Error Domain=PKInstallErrorDomain
Code=102 "The package “MobileDeviceDevelopment.pkg” is untrusted."
UserInfo={NSLocalizedDescription=The package
“MobileDeviceDevelopment.pkg” is untrusted.,
NSURL=MobileDeviceDevelopment.pkg --
file:///Applications/Xcode.app/Contents/Resources/Packages/,
PKInstallPackageIdentifier=com.apple.pkg.MobileDeviceDevelopment,
NSUnderlyingError=0x7fe07012cad0 {Error Domain=NSOSStatusErrorDomain
Code=-2147409654 "CSSMERR_TP_CERT_EXPIRED" UserInfo={SecTrustResult=5,
PKTrustLevel=PKTrustLevelExpiredCertificate,
NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED}}} 2019-11-04
13:01:20+05 tk_lpt_0141_wifi Xcode[1306]: Package: PKLeopardPackage
Failed to verify with error: Error Domain=PKInstallErrorDomain
Code=102 "The package “MobileDeviceDevelopment.pkg” is untrusted."
UserInfo={NSLocalizedDescription=The package
“MobileDeviceDevelopment.pkg” is untrusted.,
NSURL=MobileDeviceDevelopment.pkg --
file:///Applications/Xcode.app/Contents/Resources/Packages/,
PKInstallPackageIdentifier=com.apple.pkg.MobileDeviceDevelopment,
NSUnderlyingError=0x7fd230cb1ae0 {Error Domain=NSOSStatusErrorDomain
Code=-2147409654 "CSSMERR_TP_CERT_EXPIRED" UserInfo={SecTrustResult=5,
PKTrustLevel=PKTrustLevelExpiredCertificate,
NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED}}} 2019-11-04
13:29:51+05 tk_lpt_0141_wifi Xcode[1377]: Package: PKLeopardPackage
Failed to verify with error: Error Domain=PKInstallErrorDomain
Code=102 "The package “MobileDeviceDevelopment.pkg” is untrusted."
UserInfo={NSLocalizedDescription=The package
“MobileDeviceDevelopment.pkg” is untrusted.,
NSURL=MobileDeviceDevelopment.pkg --
file:///Applications/Xcode.app/Contents/Resources/Packages/,
PKInstallPackageIdentifier=com.apple.pkg.MobileDeviceDevelopment,
NSUnderlyingError=0x7f8ab8ba9380 {Error Domain=NSOSStatusErrorDomain
Code=-2147409654 "CSSMERR_TP_CERT_EXPIRED" UserInfo={SecTrustResult=5,
PKTrustLevel=PKTrustLevelExpiredCertificate,
NSLocalizedFailureReason=CSSMERR_TP_CERT_EXPIRED}}}
I have already tried:
xcode-select --install
and
xcode-select --reset
Has anyone else run into this issue? How to fix it?

First, try updating Xcode through the app store
As a last resort, you can change your MacOS Date to
1st October 2019
I set my system time to 1st October 2019, the date when the certificate was still valid. Then, I opened Xcode and followed the component install. This went well, and now Xcode works again.
Edit and set the date of your Mac as 1st October 2019.

What worked for me was updating Xcode in the App Store. After that I was able to install the additional components successfully.

Related

"The operation couldn’t be completed. Device was allocated but was stuck in creation state." (Xcode 13 iOS simulator on external device)

In order to save some of the precious 256GB of disk space on the internal drive of my (M1, 2020) MacBook Pro (MYD82LL/A) I ran the following commands in my macOS Terminal after installing Xcode in order to move all the space-hogging components to a 2TB external drive that I named "Developer" when I formatted it:
sudo mv /Applications/Xcode.app /Volumes/Developer/Applications/Xcode.app && sudo ln -s /Volumes/Developer/Applications/Xcode.app /Applications/Xcode.app
sudo mv ~/Library/Developer/CoreSimulator /Volumes/Developer/CoreSimulator && ln -s /Volumes/Developer/CoreSimulator ~/Library/Developer/CoreSimulator && sudo chown -R $USER:staff /Volumes/Developer/CoreSimulator
Despite making absolutely certain to ensure that the CoreSimulator folder has the correct ownership and permissions (hence sudo chown -R $USER:staff /Volumes/Developer/CoreSimulator above), I'm still getting this error on attempt to simulate a device (image downscaled because the 2880x1800 Retina resolution pushes the file size of the screenshot past 2MB):
Making this even more strange, I attempted this from Xcode while also running tail -f ~/Library/Logs/CoreSimulator/CoreSimulator.log in a separate terminal window. The resulting real-time log information seems to defy logic in light of the fact that I made sure (via chown) that I already had write access to the moved directory:
May 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Warning>: Device BC4197AA-A5E9-4611-98B3-4C96B2CCD460 encountered in creation state at launch. The device will be re-created.
May 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error copying sample content to path /Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460/data : Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “BC4197AA-A5E9-4611-98B3-4C96B2CCD460” in the folder “Devices”." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
May 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “BC4197AA-A5E9-4611-98B3-4C96B2CCD460” in the folder “Devices”." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
May 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Failed to re-create device that was encountered in the creation state (realkstrawn93-ip13sim (BC4197AA-A5E9-4611-98B3-4C96B2CCD460, iOS 15.4, Creating)): Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “BC4197AA-A5E9-4611-98B3-4C96B2CCD460” in the folder “Devices”." UserInfo={NSFilePath=/Volumes/Developer/CoreSimulator/Devices/BC4197AA-A5E9-4611-98B3-4C96B2CCD460, NSUnderlyingError=0x6000000000c0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
May 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: New device is stuck in creation state, deleting: realkstrawn93-ip13sim (BC4197AA-A5E9-4611-98B3-4C96B2CCD460, iOS 15.4, Creating)
May 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}
May 3 13:27:12 realkstrawn93-m1mbp CoreSimulatorService[2890] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}
May 3 13:27:12 realkstrawn93-m1mbp com.apple.dt.Xcode[24690] <Error>: ERROR creating device: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}
May 3 13:27:12 realkstrawn93-m1mbp com.apple.dt.Xcode[24690] <Error>: Error Domain=NSPOSIXErrorDomain Code=22 "Invalid argument" UserInfo={NSLocalizedFailureReason=Device was allocated but was stuck in creation state. Check CoreSimulator.log for more information.}
Note the various "You don't have permission to save the file" errors despite having already used chown -R after the directory move to attempt to rectify any permissions issues that may arise from such. So what else could possibly be wrong here?
I was able to find a workaround for this with the help of this answer
https://stackoverflow.com/a/58304540
The problem is that CoreSimulatorService needs full disk access to create files on a separate drive. To grant access you need to drag and drop com.apple.CoreSimulator.CoreSimulatorService.xpc into the apps area of Security & Privacy > Privacy > Full Disk Access in System Preferences. You can't use the + icon because .xpc files will be grayed out.
For me, this was the path to the xpc file:
/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc
I met a similar issue, and I solved like below: About this Mac > Storage > Manage > Developer and Open the screen, delete all cache, then it should work well.
Ended up simply moving all the simulator stuff back onto my local drive anyway and the problem disappeared. Not sure why Xcode complains when the simulators aren’t on the system drive though.

iOS Simulator is not installing the app at this time

When I run the newly created iOS app in iPhone 11 simulator(iOS 13) I'm getting the following error.
This app could not be installed at this time.
Error Log:
com.apple.dt.Xcode[32819] : installApplication:withOptions:error:: Error Domain=IXUserPresentableErrorDomain Code=1 "This app could not be installed at this time." UserInfo={NSUnderlyingError=0x7fc48881db10 {Error Domain=LSApplicationWorkspaceErrorDomain Code=-102 "(null)" UserInfo={Error=RegistrationFailed, _LSLine=627, _LSFunction=-[_LSInstaller _doinstallApplication:atURL:withOptions:installType:notificationJournaller:reply:], CFBundleIdentifier=com.boopathy.TestingApp}}, NSLocalizedFailureReason=Could not install at this time., NSLocalizedDescription=This app could not be installed at this time.}
Configuration Details:
macOS - Catalina 10.15 Beta(19A487m)
Xcode - 11.3(11C29)
Simulator - 11.3 (SimulatorApp-912.5 SimulatorKit-570.3
CoreSimulator-681.17)

Testing Failed when build using Xcode build command or appium

I am using :
Xcode 10.1
Os Version : 12.1
iPhone 6
I did follow all required steps to setup build and everything but still getting error when try to build project using xcode build.
I am confuse between 2 thing that is it signing issue or I am missing some config. in webdriver agent xproj.
Actual Error on xcode build command
Testing failed:
WebDriverAgentRunner-Runner.app encountered an error (Failed to install or launch the test runner. (Underlying error: Unable to launch com.apple.test.WebDriverAgentRunner-Runner. (Underlying error: The operation couldn’t be completed. (DTXMessage error 1.))))
Actual Error on appium
Error: Unable to launch WebDriverAgent because of xcodebuild failure: “xcodebuild failed with code 65”. Make sure you follow the tutorial at https://github.com/appium/appium-xcuitest-driver/blob/master/docs/real-device-config.md. Try to remove the WebDriverAgentRunner application from the device if it is installed and reboot the device.
Some other logs if that helps :
2018-11-19 11:02:17.350 xcodebuild[2413:325556] Error Domain=com.apple.platform.iphoneos Code=-12 “Unable to launch com.apple.test.WebDriverAgentRunner-Runner” UserInfo={NSLocalizedDescription=Unable to launch com.apple.test.WebDriverAgentRunner-Runner, NSUnderlyingError=0x7f8ec758be20 {Error Domain=DTXMessage Code=1 “(null)” UserInfo={DTXExceptionKey=The operation couldn’t be completed. Unable to launch com.apple.test.WebDriverAgentRunner-Runner because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user. : Failed to launch process with bundle identifier ‘com.apple.test.WebDriverAgentRunner-Runner’}}}
2018-11-19 11:02:17.350 xcodebuild[2413:325556] Error Domain=IDETestOperationsObserverErrorDomain Code=4 “Failed to install or launch the test runner” UserInfo={NSLocalizedRecoverySuggestion=If you believe this error represents a bug, please attach the result bundle at /Users/asianweb/Library/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Logs/Test/Test-WebDriverAgentRunner-2018.11.19_11-02-01-+0530.xcresult, NSLocalizedDescription=Failed to install or launch the test runner, NSUnderlyingError=0x7f8ec7ac6c70 {Error Domain=com.apple.platform.iphoneos Code=-12 “Unable to launch com.apple.test.WebDriverAgentRunner-Runner” UserInfo={NSLocalizedDescription=Unable to launch com.apple.test.WebDriverAgentRunner-Runner, NSUnderlyingError=0x7f8ec758be20 {Error Domain=DTXMessage Code=1 “(null)” UserInfo={DTXExceptionKey=The operation couldn’t be completed. Unable to launch com.apple.test.WebDriverAgentRunner-Runner because it has an invalid code signature, inadequate entitlements or its profile has not been explicitly trusted by the user. : Failed to launch process with bundle identifier ‘com.apple.test.WebDriverAgentRunner-Runner’}}}}}
Other logs info
{
deviceSerialNumber: XXXXXXXXXXXX
identifier: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6
deviceClass: iPhone
deviceName: qa’s iPhone
deviceIdentifier: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx6
productVersion: 12.1
buildVersion: 16B92
deviceSoftwareVersion: 12.1 (16B92)
deviceArchitecture: arm64
deviceTotalCapacity: 11945508864
deviceAvailableCapacity: 5477302272
deviceIsTransient: NO
ignored: NO
deviceIsBusy: NO
deviceIsPaired: YES
deviceIsActivated: YES
deviceActivationState: Activated
isPasscodeLocked: NO
deviceType: <DVTDeviceType:0x8f7ec4d00ca0 Xcode.DeviceType.iPhone>
supportedDeviceFamilies: (
1
)
applications: (null)
provisioningProfiles: (null)
hasInternalSupport: NO
isSupportedOS: YES
developerDiskMountError: (null)
(null)
bootArgs: (null)
connected: yes
isWirelessEnabled: no
connectionType: direct
hostname: (null)
bonjourServiceName: 90:60:f1:6b:7f:91#fe80::9760:f1ff:fe6b:2f92._apple-mobdev2._tcp.local.
} (12.1 (16B92))
Note : While I run it, it puts my app and webdriveragent into iphone device and then stopped.
I was able to resolve issue by following steps :
Uninstalled following :
Xcode,Appium,Xcode command line,ideviceinstaller,carthage,xpretty,deviceconsole
Reinstalled everything as per this video guide : https://youtu.be/ySglJIrDVMQ
Restart my mac machine and iphone
Again setup project in xcode as per this video guide : https://youtu.be/ySglJIrDVMQ
And Yes it works.
For iOS development I use Fastlane with the XCTest framework and I had the same problem as you described. However, I'm using a simulator, not a real device. To solve it I replaced iPhone 6 with iPhone XS Max in the list of simulators that should be used for testing. If you can also use any other device different from iPhone 6 you should try this solution.
However if you need to test your application on iPhone 6 you can recreate the corresponding simulator. In Xcode 10.1 press Window -> Devices and Simulators, then select the line called iPhone 6 and press Backspace. After that press + in the left bottom corner of window to create a new simulator. You will see this window:
Set all parameters as they are in this screenshot and then press Create. After that, try to run your test suite again.

[iOS]: Run project on sitmulator failed

I has built my project and run it on simulator. It showed error
The operation couldn’t be completed. (LaunchServicesError error 0.)
I checked system log. It showed:
Jun 8 16:53:08 com.apple.dt.Xcode[29826] <Error>: Error Domain=LaunchServicesError Code=0 "(null)" UserInfo={Error=PackageInspectionFailed, ErrorDescription=Failed to load Info.plist from bundle at path /Users/duong/Library/Developer/CoreSimulator/Devices/A980FDBA-E61F-4ED6-9F43-2C30DB071222/data/Library/Caches/com.apple.mobile.installd.staging/temp.Xf5A16/extracted/xxx.app/Frameworks/Alamofire.framework}
How could I fix that? Please help me. Thank you.
please follow these steps
1. reset simulator
2 delete derived data
3 clean Xcode and try again

Unable to "apportable load". Give NoneType error

Trying to use apportable for the first time. Keep getting this error:
TypeError: 'NoneType' object is not subscriptable
and also
NSUnderlyingError = "Error Domain=NSPOSIXErrorDomain Code=2 \"The operation couldn\U2019t be completed. No such file or directory\"";
And then the script terminates.
xcode-select --switch /Applications/Xcode.app/Contents/Developer
Background: This can occur if you've updated to Xcode 5. It seems Xcode 5 has a bug that it can generate incorrect output when running xcodebuild.

Resources