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

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

Related

How can I correctly provision an Xamarin Forms iOS app with (or without) a ShareExtension?

I've had hours and hours of problems with Xamarin Forms iOS provisioning for my app with and without a ShareExtension.
I have had it working in the past with various combinations and permutations of configuring simulator/device/debug/release/certs/ids/auto or manual provisioning...etc. which I didn't record at the time, but it is very fickle and unpredictable and there are a large number of moving parts.
As such the following is a systematic record of the steps I've taken with questions when things have behaved in unexpected ways and my app hasn't run or deployed correctly.
NOTE: The following steps are for development but if I can get dev running, I will then continue to update this question for the distribution process.
The 3 main elements and their interaction that causes me most confusion are below:
Online Apple Developer Portal
MacOS with Xcode and keychain
Windows Visual Studio Xamarin
STEPS TAKEN
A) DELETE EVERYTHING FOR A FRESH START
I deleted all my certificates, identifiers and profiles from the above 3 (with the exception of the main app id which is in the app store and couldn't be deleted). For the physical devices I removed via:
Xcode
VS (Win)
relevant folder locations on Win and Mac
keychain
B) CREATE A DEV CERT, AUTO PROVISION, RUN THE APP
In visual studio login to my Apple account via Options -> Apple Accounts
Then View details -> Create certificate
Outcome: This works fine. The new cert appears on Windows, Mac and on the Apple Dev Portal. The app runs successfully with auto provisioning.
However, no profiles can be seen in the online Apple Dev Portal - why? - UPDATE: They now appear around 30 mins after they were created
C) ADD A SHARE EXTENSION
Add ShareExtension project and reference it to my main app.
Use Automatic Provisioning
Outcome:
Auto Provisioning gives: "Invalid request, Service mapping to the requested URL is not available.". As a result I go into the Apple Dev Portal and manually create an ID, then retry Auto Provisioning, which is now successful. Try to run the app again but: app runs ok, but share extension can't be seen.
I have double checked:
Main app has ShareExtension reference
Main app info.plist has:
<key>NSExtensionPointIdentifier</key><string>com.apple.share-services</string>
App group is set in VS for both projects and both App IDs in online portal
What is going on here?
---UPDATE---
D) TRY MANUAL PROVISIONING INSTEAD
I did the following:
Created two manual provisions, one for container and one for extension
As Visual Studio Apple Account didn't reflect these, I downloaded the provisions from the portal, put them in the relevant Windows folder and now they appear
Tried to build:
What is happening here?
Why is the error about Auto Prov, when I have clearly set it to Manual Prov
Why is the 2nd error about the profile not found when it shows in above drop-down, and in the portal that it very clearly exists?
After much pain, I have finally stumbled upon a combination of steps that seems to work. Given the unpredictable and what seems to be buggy nature of VS, I cannot guarantee that this will work for everyone, or even guarantee that it will even work for me again for my next build, but it has been working for the past 12 hours or so over several builds and deployments. I can only pray that it continues to work.
Anyway, here are keypoints that I used to get it working:
Follow my step A) above and delete everything as often as possible. New certs and profiles in the Portal tend to accumulate after a while, possibly when creating via the Portal, Xcode and VS, so it's good to remove everything every so often and start from afresh.
VS for Mac is I believe a much cut-down and less capable version of VS for Windows. As such when doing development, VS Windows is a far better tool, if you can get around development provisioning. I struck upon a combination where I created the Cert in VS Windows (this is preferable to creating in the Portal because it avoids having to download the cert and ensure it is installed correctly on your local machine), and used Automatic provisioning for debug that seemed to work for me. It didn't work for a while, nor did manual provisioning, but somehow for now its working.
Once the app is stable in debug mode, and you want to deploy to App Store Connect:
a) manually create your distribution certs on Xcode, and create profiles in the portal
b) move your code onto VS Mac
c) build and archive using the new distr profiles
d) Goto Xcode -> Window -> Organizer
e) Locate your archive and click Distribute App
f) From here the wizard will guide you again into selecting relevant profiles for distribution for both container and ext and give you a lot of feedback on the upload process until the upload is complete.
Anyway, once again, no guarantees that will work for all, but it's working for me now.
Cheers!
I have also tried using Visual Studio 2022 to finish an iOS development process but cannot reproduce your stepD. The following is the main step:
1. Create App ID for container and extension, Create an AppGroup ID
This is for my container, with App Group enabled.
This is for my extension App ID, also enable the same App Group.
2. Create certificate and profiles
You could create a iOS development certificate in Visual Studio or in Apple Dev Portal. Then you could find it in your Certificates.
3.Generate your profiles for both container and extension. (Remember to register your physical device in Devices, and in your profiles, includes your device on which your app is installed)
This is for my container with the container's App ID
this is for my extension with the extension's App ID
4. In Visual Studio, select the proper provisioning file.
Before this step, also download the provisioning files from the portal as VS does not automatically download them. Put them in the relevant Windows folder.
This is for my container, with the certificate and the provisioning file
This is for my extension:
Also, my info.plist for container and extension:
5. Pair to mac and run on your device
Now the App could install on your device~

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

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?

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.

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