I accidentally deleted Apple certificates necessary for the deployment of Xamarin app to iPhone SE2. I created new certificates, added them to KeyChain with Macin Cloud, created new provisioning profiles and everything seems to be working properly, but I am getting an error from VS Studio when deploying the app.
The error is caused by:
Unhandled Exception: Xamarin.iOS.Windows.WindowsiOSException: Failed to install the application: ApplicationVerificationFailed(3892346905) - Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.mDjJvM/extracted/Payload/TestAppName.iOS.app : 0xe8008019 (The application does not have a valid signature.)
I do have paid Apple Developer account and I am using Visual Studio 2019 16.9.5 on Windows 10. I tried cleaning/rebuilding the solution, creating new projects, deleting C:\Users\User\AppData\Local\Temp\Xamarin folder. I can see both; certificate and provisioning profiles in Tools>Options>Xamarin>Apple Account>"View Details" window, the certificate is valid and the profiles are new (not expired).
My guess is that I may need to use my private key in KeyChain to verify the certificate, but I can see the certificate under my private key already.
Full error message:
Build started...
1>------ Build started: Project: TestAppName, Configuration: Debug Any CPU ------
1>TestAppName-> C:\Users\User\source\repos\TestAppName\TestAppName\TestAppName\bin\Debug\netstandard2.0\TestAppName.dll
Apple Support - iTunes installed: 'True', Installation type: 'Store'
Apple Support - iTunes installed: 'True', Installation type: 'Store'
2>------ Build started: Project: TestAppName.iOS, Configuration: Debug iPhone ------
Apple Support - iTunes installed: 'True', Installation type: 'Store'
2> Detected signing identity:
2> Code Signing Key: "Apple Development: Jiri Drnec (MMU6BXN6UX)" (C:\Users\User\AppData\Local\Xamarin\iOS\Provisioning\Certificates\78B9A3FF0AE04D1A10A7B244AE7313EE.p12)
2> Provisioning Profile: "VS: WildCard Development" (C:\Users\User\AppData\Local\Xamarin\iOS\Provisioning\Profiles\c9923f8c-a6ec-458e-ae66-daa3eea9a21a.mobileprovision)
2> TestAppName.iOS -> C:\Users\User\source\repos\TestAppName\TestAppName\TestAppName.iOS\bin\iPhone\Debug\TestAppName.iOS.exe
Apple Support - iTunes installed: 'True', Installation type: 'Store'
3>Starting deploy 'TestAppName.iOS' into the device 'Hanka - iPhone'...
3>Deploying 'TestAppName.iOS.app' into the device 'Hanka - iPhone'...
Deploying app...
Starting Apple Service 'com.apple.mobile.installation_proxy'...
Stopping Apple Service 'com.apple.mobile.installation_proxy'...
Creating application ipa file: C:\Users\User\AppData\Local\Temp\Xamarin\HotRestart\Signing\TestAppName.iOS.app\out\TestAppName.iOS.ipa
Starting Apple Service 'com.apple.afc'...
Uploading file 'C:\Users\User\AppData\Local\Temp\Xamarin\HotRestart\Signing\TestAppName.iOS.app\out\TestAppName.iOS.ipa' to 'PublicStaging'...
Validating device directory 'PublicStaging'...
Creating file 'PublicStaging/com.companyname.TestAppName' in 'PublicStaging'...
Writing content to file 'PublicStaging/com.companyname.TestAppName'...
Closing file 'PublicStaging/com.companyname.TestAppName'...
Stopping Apple Service 'com.apple.afc'...
Starting Apple Service 'com.apple.mobile.installation_proxy'...
CreatingStagingDirectory. Total progress: 5%
ExtractingPackage. Total progress: 15%
InspectingPackage. Total progress: 20%
TakingInstallLock. Total progress: 20%
PreflightingApplication. Total progress: 30%
InstallingEmbeddedProfile. Total progress: 30%
VerifyingApplication. Total progress: 40%
Unhandled Exception: Xamarin.iOS.Windows.WindowsiOSException: Failed to install the application: ApplicationVerificationFailed(3892346905) - Failed to verify code signature of /var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.mDjJvM/extracted/Payload/TestAppName.iOS.app : 0xe8008019 (The application does not have a valid signature.)
at Xamarin.iOS.Windows.Installer.ApplicationSession.OnInstallProgressReport(IntPtr command, IntPtr status, IntPtr userData) in C:\A\1\1\s\src\Tools\Xamarin.iOS.Windows.Launcher\Installer\ApplicationSession.cs:line 324
An error occurred while trying to deploy the app 'TestAppName.iOS.app'. Details: Error running hotrestart: 'An unexpected error occurred and the process has been terminated'. Command: 'deploy -u=00008030-0009552A0E50402E -i=com.companyname.TestAppName-n=TestAppName.iOS.app'
3>Deploy failed. The app 'TestAppName.iOS.app' could not be deployed to the device 'Hanka - iPhone'. Please check the logs for more details.
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========