Search code examples
iosmacosvisual-studioxamarin.formsapp-store-connect

"A valid provisioning profile for this executable was not found" for Xamarin.Forms iOS RELEASE build to an iPhone Device


So my certificates recently expired, and I had to create new ones. I created both an Apple Development and an Apple Distribution certificate from Visual Studio and they both show up as valid and/or in keychain in Apple Developer, Visual Studio, and Xcode.

I of course updated the app's development and distribution profiles to use these new certificates and made sure to re-download them to my workstation.

The iOS component of the (Xamarin.Forms) app can deploy the Debug build to both a simulator and a real device. It can also deploy the Release build on simulators. Archiving a build for publishing also worked fine. It uploaded on TestFlight and was successfully installed by a tester.

The issue is only with deploying a Release build to my test device. The Release build has been deployed successfully to this same device before, so I am very unclear as to what has happened.

The bundle signing identity and provisioning profile were set to automatic as recommended. To make sure the bundle was using the correct profile, I set them instead to the expected/correct distribution identity and profile, and the deployment still fails.

The app did use to have an iOS Distribution certificate, but that seems to have been replaced by Apple Distribution as far as I can tell. I see that iOS * certificates can still be created on Apple Developer, but they're not listed as options when creating certificates from Xcode or Visual Studio for Mac. I did try pointing the provisioning profile to an iOS Distribution certificate created online, and it still did not work.

I've also restarted Visual Studio, Xcode, the iPhone device, and my Mac workstation to no avail.

Is there something else I could be missing? I am new to app development and am very unclear as to what else "invalid provisioning profile" could mean.

Any additional help/tips/ideas would be appreciated!

Error message when deploying:

ApplicationVerificationFailed: Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.FSRtzC/extracted/{XAMARIN_IOS_PROJECT_NAME}.app : 0xe8008015 (A valid provisioning profile for this executable was not found.) error MT1006: Could not install the application '{PATH TO XAMARIN_IOS_PROJECT}/bin/iPhone/Release/{XAMARIN_IOS_PROJECT_NAME}.app' on the device '{IPHONE DEVICE NAME} iPhone': AMDeviceSecureInstallApplicationBundle returned: 0xe8008015.

Application could not be uploaded to the device.

Provisioning Profile Info:

Status: Active

Type: App Store

Enabled Capabilities: Associated Domains, Game Center, In-App Purchase, Push Notifications

Software Versions:

Visual Studio Community 2019 for Mac Version 8.6.5 (build 23)

Apple Developer Tools Xcode 11.5 (16139) Build 11E608c

Xamarin.Mac Version: 6.18.2.1 (Visual Studio Community)

Xamarin.iOS Version: 13.18.2.1 (Visual Studio Community)

iPhone 7 Plus running iOS 13.5.1


Solution

  • I simply had to use a Distribution Profile of type Ad Hoc. The Distribution Profile the app was using was of type App Store as it was what was needed to create a build archive for Test Flight.

    I do wish the error message had been more informative and less generic. Multiple types of issues seem to result in the same error message.

    Useful References:

    • This provides useful info about using the Device Log and debugging Entitlements that helped me start getting somewhere. My custom Entitlements and enabled Capabilities for the Bundle Identifier matched, so I couldn't figure out what else to try initially. The Device Log gave me no info, but taking out the Entitlements file worked, and it went from there.
    • This reassured me that my one custom entitlement that's different between Debug and Release mode, APS Environment, is using the correct value of "production" even though it was causing the installation to fail with the (then App Store) Distribution Profile.
    • This provides detailed explanation on each Provisioning Profile Type.