Visual Studio - Xamarin Forms app - Unable to set up Automatic Provisioning for certificates - ios

Brand new PAID Developer Account - received confirmation of set up from Apple about a week ago.
Trying to set up either Automatic OR Manual Provisioning for certificates but getting an error.
I've tried from both Visual Studio 2019 (16.10.4) on Windows, and from Visual Studio for Mac (8.10.6 Build 10).
Xcode on the Mac is version 12.5.
From within Visual Studio
Attempting to set Automatic Provisioning
Automatic Provisioning Failed.
Resolving certificate...
Fetching valid and locally installed signing identities...
Syncing certificates for "John Doe" team...
Saving Apple Development certificates...
Automatic Provisioning failed: Length cannot be less than zero.
Parameter name: length
Attempting Manual Provisioning ("Create Certificate")
On Windows
On Mac
As I said, I have tried this from within both VS for Mac and Windows, with same result.
I've tried deleting the reference to my development account, and re-entering it, but it made no difference.
I've also logged in to my developer account within apple.com to check that all agreements have agreed to, and everything looks fine to me.
Can anyone offer any advice?

Related

archive for Publishing Xamarin IOS App from Visual studio windows does not work

I am trying to archive my Xamarin Ios project from my window 10 visual studio connected with a mac ssh on macincloud. I would to publish my app on appstore but I got an error when archiving it
I have done all the steps about (https://developer.apple.com/) and I have created the certificate and profiles using automatic provisionning of VS Xamarin IOS
Here is my screen :
Here is my second screen :
Here is my error :
Thanks for your help
Couple of things to be considered here
Automatic publishing needs a registered device in apples developer portal with a valid UUID.
Automatic publishing is for development , manual is for distribution
Follow the Microsoft guide for publishing ( different for distribution). States it has to be manual and gives some settings for publish configuration.
Update the apple certificate that has expired in Feb 2022 in keychain to the latest 2030). Apple worldwide authority
Open iTunes on windows machine and make sure to accept the newer terms and conditions (nightmare to find that)
Make sure your bundle I'd matches what you setup in the portal. Com.companyname.appname
Im also getting the code sign 1 error , above is all the things I've had to do these last 3 days and still no success.
I have put visual studio on my Mac and it's actually giving more details to the error. Appears to be failing with a reference. Might want to try that with your app of you have a Macbook.
The process is very clunky, same on you Microsoft

Error adding Apple Developer Account: authentication service is unavailable

I’m trying to add an apple developer account to VS 2019 Community ver. 16.9.2 for Windows.
Once I set the Apple ID and Password and click on Login, I get the following message:
“There was an error while trying to log in: Authentication service is unavailable.”
The Apple ID and Passwords are correct, in fact, if I type in the wrong credentials then Visual Studio complains about invalid id/password combination.
I disabled the firewall during the process so this should not be a connection issue.
Also, I made sure I have no pending agreements on Apple Store Connect. My apple developer account is valid and has no issues. In fact, I can use the same account on xcode just fine.
Is there some workaround?
THIS ISSUE IS FIXED IN THE 16.9.6 VISUAL STUDIO UPDATE !!!
(old workarounds)
There are some workarounds but none of them worked for me and updating to the latest version didn't help either (Visual Studio 2019 16.9.4). For as far as I know this issue persists even on version 16.7.5 of VS2019. For some people the workarounds seem to work so I will list them here so hopefully some of us can get on with our projects.
Workaround 1 (offered by Xamarin team):
Close Visual Studio 2019
Delete the following folder %LOCALAPPDATA%\Temp\Xamarin\XMA
Open project -> clean sollution
Set Automatic for bundle signing in the iOS project settings
Rebuild
(- if it doesn't work try again after restarting pc)
Workaround 2:
Delete your apple account from VS2019 through Tools–> Options --> Xamarin–> Apple Accounts
Sign back in again
Download your provisioning profile from developer.apple.com account to you pc
Copy and paste it into: \Users\YOUR_USERACCOUNT\AppData\Local\Xamarin\iOS\Provisioning\Profiles
If it doesn't work, perform in combination with workaround 1
Workaround 3:
Delete apple account from VS
Remove certificates from AppData\Local\Xamarin\iOS\Provisioning\Certificates
Remove profiles from AppData\Local\Xamarin\iOS\Provisioning\Profiles
Add Apple account
Set to Automatic Provisioning and select team, it will error again but will reinstall the certificates
Manually download provisioning profile and copy it to - AppData\Local\Xamarin\iOS\Provisioning\Profiles
Run the archiving process should error out again but the “id” or name of the provisioning will be displayed in the error
Rename the provisioning file to match and rerun archiving.
As I said these workarounds don't work for me but I hope they do for you. If it doesn't then you're in the same boat as me and you're going to need to follow this thread:
https://developercommunity.visualstudio.com/t/Error-adding-Apple-Developer-Account:-au/1380749?viewtype=all
I was able to use a combination of several workarounds from Michael's answer to get the app signed and deployed on an iPhone (for debugging). Here are the steps in correct order that worked for me:
Set Automatic for bundle signing in the iOS project settings
Delete your apple account from VS2019 through Tools–> Options --> Xamarin–> Apple Accounts
Close Visual Studio 2019
Delete the following folder %LOCALAPPDATA%\Temp\Xamarin\XMA
Delete all "obj", "bin" and ".vs" folders for the solution
Download your provisioning profile from developer.apple.com account to you PC and save it to %LOCALAPPDATA%\Xamarin\iOS\Provisioning\Profiles
Open Visual Studio 2019
Add your apple account from VS2019 through Tools–> Options --> Xamarin–> Apple Accounts
Build. It will error out while signing the app.
Look at the error. It should specify the expected file name for your provisioning profile. The file name is a long string of hex digits with extension ".mobileprovision".
Go to %LOCALAPPDATA%\Xamarin\iOS\Provisioning\Profiles and rename your provisioning profile file into file name from the error message.
Build again. It should work now!
I just went through the exact same problem and it took forever to work out. I'd had my app running locally and debugging on my iphone just fine. A few months later this bug popped up... I needed to simply update iTunes. iTunes handles the handshake stuff for your iOs devices and Windows.

Visual studio unable to locate provisioning profiles for Xamarin.iOS

I am trying to setup my environment to deploy my app to a real IPhone for testing because I dont want to work with simulators and etc. It apparently requires provisioning profiles. I dont have a paid apple developer account and I learned that it is not required. These are the steps I have done so far:
Open xcode on my mac go to Preferences> Accounts> Add new Apple ID. I added one of my apple IDs.
I then added a new project select a team and selected necessary options to create the project
I went to project propertiesi setup the iOS version.
I went to signing and enabled automaticly manage signing. It did something and created a certificate for me.
I deployed the app once to my phone which worked fine.
I later opened visual studio on my windows machine.
Paired my mac with my visual studio.
Went to info.plist and copied my bundle identifier from xcode to visual studio.
Enabled Manual provisioning but no developer profiles. Restarted VS but no luck
I basically followed this site
https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning?tabs=windows
I tried without selecting a specific provisioning profile (it was in developer (automatic))
It seemed to be going well until it gave this error
error MT1007: Failed to launch the application '/Users/xxxxxxx/Library/Caches/Xamarin/mtbs/builds/App8/4ae6e8b79af6f5c06054809bff907c4f900782cdb32378817eb5bbdd1fa2e996/bin/iPhone/Debug/device-builds/iphone11.8-14.2/App8.app' on the device 'iPhone': Failed to launch the application 'com.xxxxxxxxxxxxxx.App8' on the device 'iPhone': Invalid Service Error (error: 0xe8000022) 0
I found the solution to my problem. The site https://learn.microsoft.com/en-us/xamarin/ios/get-started/installation/device-provisioning/free-provisioning?tabs=windows showed illustrations of choosing specific provisional profiles
However I didn't get this kind of choosing
Mine had
Developer (automatic)
No profiles found (or something in english: my VS is not in english)
but apparently it is not required to choose the exact profile from VS. I was able to deploy the app by just compiling the app as usual (after following the steps of course). However there is a problem with launching the app which requires me to go to settings and trust my apple id or something which is not important.

Could not find any available provisioning profiles for iOS

We are developing a iOS shopping cart application in c# and visual studio 2017 for xamarin. I have an iPad Air iOS 10.3, when I try to publish to real device, I am getting the following error message: "Could not find any available provisioning profiles for iOS", I have tried to restart my Mac - without result. Give me any suggestion to resolve this issue?
In Visual Studio for OSX, go to Visual Studio Community > Preferences > Publishing > Apple Developer Account and click to + button to sign in and add your developer account. In theory after that automatic provisioning should work.
In Visual Studio for Windows, go to Tools > Options > Xamarin > Apple Accounts, you will get a prompt to install FastLane before your Apple ID will show up under Automatic Provisioning.
You must create a provisioning profile. Search on Google, how to do it.
But, the secret is: when you create a provisioning profile, you must associate an App ID to this profile, like: "com.companyname.*".
When you create your app in visual studio, you must set in the INFO.PLIST file on IOS PROJECT, the Bundle Identifier to "com.companyname.myapp1" or anything else.
If your Bundle Identifier has a name like "com.myapp.app1", you will get this error: Could not find any available provisioning profiles for iOS, because your profile accept only apps with the names started with com.companyname and you are using a appname different.
For those who just want to deploy/test their app on a real device with "Free provisionning" follow this official guide.
To sum it up :
Create an apple id
Add the previously created apple id to XCode in order to add a provisioning profile.
Create a new empty iOS app with the bundle identifier equals to the one of your Xamarin app (you can find it in Info.plist of your Xamarin.iOS project).
Ensure that your empty iOS app could be deployed, by running it from XCode on your device with your free provisioning profile.
In Visual Studio open Info.plist and click on Bundle Signing Options..., in Signing identity chose Developper automatic and Automatic in Provisioning profile.
Run your Xamarin.iOS app on your device.
You can see what was wrong with your provisioning profile in xCode. Also this procedure will update Provisioning profiles, Certificates, App Ids:
Go to xCode, create blank iOS application, type the same Bundle Identifier, that you had in Visual Studio.
On the same page uncheck "Automatically manage signing".
In Signing (Debug) click on Provisioning profile. You will see Eligible and Ineligible provisioning profiles. You can select each of them and if one is Ineligible, then errors will be shown below. After that you can fix them.
After that you can go to Visual Studio for Mac and create the same project with the same bundle id and check you profile in Project -> Options -> iOS Bundle Signing -> Provisioning profile
After that you will find your Provisioning profile in Visual Studio on Windows
I suggest you read this documentation to learn more about iOS provisioning.
What you want is called automatic provisioning though. It takes care of all the complex things about provisioning for you and just deploys the app.
Visual Studio on Windows has the automatic provisioning feature in preview (called 15.7) right now (preview 3): https://learn.microsoft.com/en-us/visualstudio/releasenotes/vs2017-preview-relnotes#xamarin-provisioning.
I recommend you try that, it should help you automatically add your iPad to the relevant provisioning profile.
Visual Studio for Mac has had automatic provisioning for a couple releases now.
Note: you do need an Apple Developer account to deploy on device (it can be a free developer account).
Unbelievable but true...
To enable the interface, I first had to login with my Apple account under:
https://itunesconnect.apple.com
and
https://appleid.apple.com
and agree the new privacy agreement from Apple. There isn't any error message that points you in this direction ("you first have to agree...").
After doing that, I was able to use the automatic provisioning in VS2017 and connect to the Mac.
All of these answers are right.
There are many reasons the creation of the provisioning profile certs bundle can fail. The one I dont see listed here is referenced in (Apple developer account teams not showing up on VS Mac)
Only XCode can set up the provisioning for you using the free apple dev Id. You need to create a dummy project with the same Bundle Name and Bundle Identifier. Build it in XCode and have XCode create the certs for you.
Only once i did that (on the paired Mac) did it start actually building my iOS target in Windows VS 2017
How did I have to solve this?
First background
I have already provisioning profile for app we are building but every once in a while I have to create a small POC app to prove something. And often I have to use that small app on real provisioned device.
But I was not even able to see my device for that small POC app in the dropdown showing available devices. Only the app I am building with my team will show.
Solution
To resolve this, I had to do
In my POC app > Info.plist, make sure your Bundle Identifier is same as for the app that you can deploy to your device
At the same location, under Signing, select "Automatic Provisioning" and you should see your Apple ID show. In Team dropdown, select your team
After this, my device showed, I was able to build and deploy to it and the error was gone.
I have tried all the above-mentioned approaches but didn't work. I was using Manual provisioning.
To identify why it's not showing in VS, I have:
Opened the Xamarin.ios project in Xcode.
Under Settings > Manual provisioning profile,> Selected the appropriate certificate (Note: It should be installed before it appears in the list).
It showed me an error, which said "Selected provisioning doesn't match with the distribution certificate in the keychain"
When I logged into developer.apple.com - I have found a new distribution certificate.
I had to regenerate the provisioning profile with the new distribution certificate (selected) and installed it.
After installing the error went away.
Also, In the Visual Studio's drop-down list the provisioning profile started to appear.
I agree with Meekohi & Vincent Dondain who have recommended choosing Automatic Provisioning, as it's a better option if one is not facing any issues with certifications or profiles as it takes care of everything. However, using the latest Visual Studio for Mac is preferable.
just hit the same problem. didn't find solution in this thread that i came to.
Xamarin app, visual studio for mac . manual signing
didn't use it for few months.
works good on emulator but can't deploy to device for debugging
after reading this thread went to developer.apple.com and found, that my developer profile expired a month ago.
create new provisioning profile
visual studio for mac-preferences-apple developers account-details-download manual profiles
info.plist-bundle signing options-choose correct identity and profile
Answer ( I have had this issue 2 times by switching MACS & adding new applciations )
Issue: Profile not showing up in dropdown below ( Automatic Distribution or Distribution )
As long as you are sure your info.plist is ok and have matching ( com.companyname.something ) & your CERTS are in Keychain then this is what is what cleared it up for me 2 TIMES !
** This seems to be some sort of refresh issue ( where a old profile is cached OR newer profile/bundle not loading in MAC )
[ I use VS on Windows and connect to MAC ]
Open Visual Studio for MAC ( not windows )
Create a new ( blank form ) iOS project
Click Visual Studio in Menu and Click Preferences
Click Apple Developer Accounts ( ADD YOUR APPLE ACCOUNT )
CLICK VIEW DETAILS & DOWNLOAD ALL PROFILES & Close
Open info.plist in your Folder View in VS
Check Manual Provisioning & Type in bundle Identifier com.companyname.whatever & App name
SAVE
RUN BLANK APP & CLOSE IT
10 ********* Go back to Windows right click on iOS Project Select Distribution AND YOUR BUNDLE IS IN THE DROP DOWN !!
[ If bundle not there re-connect to MAC right click and see if its there in your dropdown - remember the bundle must be in your iOS project ( root ) ]
( Automatic distribution will work as your bundle will be in the dropdown below in Windows Visual Studio & RELEASE TO APP STORE ).
One of the reason could be that there is no Provision profile file
For MAC the path is /Users/apple/Library/MobileDevice/Provisioning Profiles
You need to download the corresponding provision file from apple developer account and then paste it here in the above directory
Then, it will start reflecting in Visual Studio
Make sure you have a valid development certificate, it is added to your Keychain, and that you are signed into Xcode (Settings > Accounts).

Is it possible to build xamarin.ios applications on mac host for vs2015 with free license?

I installed OS X Yosemite ("Hackintosh" ) inside of Virtual Box on Windows, set the Network adapter to "Bridged Adapter" and get the Xamarin build host installed and running (as well as Xcode from the App Store), paired it up on VS2015, got it to the point of building and then it got stuck on the error message:
1>C:\Program Files
(x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(524,3): error :
No installed provisioning profiles match the installed iOS code
signing keys.
Started investigating into this, followed some articles where it should come to Xcode Account. I entered my Apple Id, then checked created certificates, but it never gets into download of provisioning profiles.
I dont intend to publish I only want to check Xamarin on the apple Iphone simulator, so can I get around to being able to do this without enrolling for paid apple developer program?
You'll have to create a app ID before you can create a provisioning profile.
You can do that on developer.apple.com/ios

Resources