Xamarin “The executable was signed with invalid en

2020-06-12 05:56发布

问题:

I want to test my created iOS app on my iPhone. The build was successful but while xamarin studio tries to transfer the file via usb to my iPhone i got the following error:

VerifyingApplication: 70%
  PercentComplete: 40
  Status: VerifyingApplication
 ApplicationVerificationFailed: Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.yNZx88/extracted/<APPName>.app : 0xe8008016 (The executable was signed with invalid entitlements.)
error MT1006: Could not install the application '/Users/<NAME>/Projects/<APPName>/<APPName>/bin/iPhone/Debug/device-builds/iphone8.2-10.2.1/<APPNamr>.app' on the device '<DEVICEName>': Your code signing/provisioning profiles are not correctly configured. Probably you have an entitlement not supported by your current provisioning profile, or your device is not part of the current provisioning profile. Please check the iOS Device Log for details (error: 0xe8008016).
--- inner exception
Xamarin.Installation.FailedInstallException: Your code signing/provisioning profiles are not correctly configured. Probably you have an entitlement not supported by your current provisioning profile, or your device is not part of the current provisioning profile. Please check the iOS Device Log for details (error: 0xe8008016)

[...]

Application could not be uploaded to the device.

I'm new to xamarin and don't know what to do. A apple developer account is available and the certificate and provisioning Profile are created. The phone is added to device list and a identifier is are created.

Can anyone help me?

回答1:

UPDATE:

First, make sure both Xcode and Visual Studio for Mac are updated to latest versions. If you update Xcode, open it. Sign in. If it asks to "Install additional required components?", pick "Install". Then re-open the updated VS.

With newer Visual Studio for Mac and Xcode, you might have all the info you need in the "Deploying to Device" tab that appears when you launch to phone (from VS) a Debug | iPhone version of your app. Scroll to bottom of that tab, look for a message like:

ApplicationVerificationFailed: Failed to verify code signature of ... (The executable was signed with invalid entitlements.)

... Your code signing/provisioning profiles are not correctly configured. Probably you have an entitlement not supported by your current provisioning profile, or your device is not part of the current provisioning profile. Please check the iOS Device Log for details (error: 0xe8008016).

In some situations, the instructions below won't give you any more useful detail than the above. For example, I'm not seeing (even in iOS Device Log) which entitlement is failing; I had to fix the above by comparing the entitlements my app had checked in info.plist, with the certificate I was using. If in doubt, try unchecking all entitlements in info.plist. Deploy again. (Obviously any functionality that needs the entitlement won't work, but at least you can verify you are able to deploy without that error message.)


Original answer:

(Regarding comments on the question) What you need is NOT the logs in Xcode - those are crash logs. What is needed here is in Xamarin / View / Pads / "Device Log". While installing the app, messages will scroll by.

Open the Device Log pad before starting the install - it is a dynamic display of messages from your phone. Select your phone from the dropdown list at top left of pad. (At any time, click eraser icon at top right of pad, to clear the old messages.)

If many messages are scrolling by, then click on the i-inside-blue-circle icon (tooltip "Show Messages") (unselect it) to hide the Info messages. Make sure that x-in-red-circle icon (tooltip "Show Errors") is selected.

After the install fails, "select all / copy / paste" into a text editor. Search for the install failure. Immediately before it should be some lines that give more information. Specifically, it will clarify which of these two possibilities is the problem: 1) entitlements or 2) something about device.

I'll bet its entitlements. You'll need to isolate what entitlement is causing the problem. Are you using Push Notifications? iCloud? Those are likely culprits. Or perhaps one of the privacy related entitlements - make sure you are following current instructions for the latest iOS version: new privacy settings were added in iOS 10, then 12, then 13 (IIRC).

Look at source code of Entitlements.plist. Save a copy of that somewhere away from your project. Start with a blank (empty) Entitlements.plist. [Add an empty text file with that name, if you don't have it in your project folder.] Are you then able to deploy to phone?

Of course, you won't be able to use the entitlements you need, while this is blank, but you should be able to get the first screen of your app up, or at least some Apple dialog asking user if they want to allow ..whatever entitlement you needed..

Then add to Entitlements.plist until you can't deploy. Then Google for that specific problem - hopefully there is a solution out there.


Another possibility is that your provisioning profile lacks an entitlement that you are asking for. Go back to Apple developer website, where your certificates and provisioning profiles are listed. Select the prov. profile you are using. Under "Enabled Services", make sure it lists the services you are using.
(Some Apple features don't require specific entitlements; if in doubt, create a new provisioning profile, and look carefully at all the options for entitlements, for any feature you are using.)



回答2:

If your provisions were working before you added and set your "Entitlements.plist" (for example for Icloud) then:

You need to remove the "Entitlements.plist" from your configuration.

Project Option > IOS Bundle Signing > Custom Entitlements (Keep it blank).



回答3:

This fix for me :

  1. Right click on IOS Project and click on Options
  2. If you see under Custom Entitlements: Info.plist then change it to Entitlements.plist
  3. Compile project again and test it