Xamarin.Mac installer not working - xamarin

I have a Xamarin.Mac solution that runs correctly in Debug or Release build from within Xamarin Studio, but I am struggling to create a working installer for it.
I want to use direct distribution (outside the App Store), so this is the procedure I used to create the installer:
Within the Apple developer portal:
Created "Developer ID" application and installer certificates
Created an App ID for the app
Created a provisioning profile that references the App ID and the
application certificate
Downloaded the 2 certificates and the provision profile
On the development Mac:
Double-clicked the 2 certificates and verified that they were
installed in Keychain Access
Double-clicked the provisioning profile and verified that it was
installed in Profiles
Within Xcode:
Opened Preferences > Accounts and downloaded the provisioning profile
Restarted Xcode to propagate the downloads to Xamarin Studio
Within Xamarin Studio:
Configured the Bundle ID in info.plist (to match the App ID)
Selected the Release build signing identity, as created above
Selected the Release build provisioning profile, as created above
Selected the Release build installer identity, as created above
Rebuilt the solution in Release build configuration
After the build is complete, the bin/Release folder contains everything I would expect, including the .pkg and .app files.
If I double-click the .pkg file, it appears to correctly execute the installation sequence, but the installed app is not listed in Applications or Launchpad. Moreover, if I run the .app file from its bin/Release folder, it executes correctly, but if I manually move it to the Applications folder, it crashes on startup.
Within Utilities > System Information > Software > Applications, I can see that the app was installed and that its source is an "Identified Developer", so this seems to confirm that the signing worked correctly.
I'm puzzled why, if it was correctly installed, I am unable to run it.
Sorry, I am quite new to both Mac and Xamarin.Mac, so I am not completely sure what I should expect to see here, but I assume it's more than I am currently seeing.
Any clues please?

Likely if you are able to run an application locally but not able to via an installed package, you are running into code signing issues.
As noted here you could try running your application from the command line:
Run your application from the command line and look at the output (in
the Terminal app) by using: MyApp.app/Contents/MacOS/MyApp (where
MyApp is the name of your application)
and see if you are getting a code signing specific error on launch.
If so, then possibly your machine may not be on the provisioning profile/certificate selected.

Related

Xamarin: Unable to upload Archive to AppStore

Visual Studio 2019 (Windows) /
Xamarin 4.7.0.968
I create an iOS Archive (with no errors) but when I choose Distribute / AppStore and select the ID/Profile that I have already set up in Visual Studio, I get prompted for ID/Password as expected. But then it fails with the error:
AppStore bundle validation failed for archive MyApp.Mobile.iOS
"altool" exited with code 1.
Does anyone have any ideas what may be wrong?
Uploading to the App Store didn't worked for me following these instructions and using Visual Studio 2019 (16.7.1). I always got
Errors
App Store bundle validation failed for archive XXX
"altool" exited with code 1
We are unable to create an authentication session.
Apple mentions three ways for uploading:
Xcode
altool
Transporter app
The easiest way is to use Xcode. When you have build for Release and archived your application (in VS 2019 on your Windows machine), you can do this on your Mac in Xcode: Window > Organizer > Archives > Distribute App
Unfortunately, the upload from VS doesn't give you proper message why the upload fails. In order to debug it, you need to upload it "manually". The steps are:
Build your project in Release configuration
Right click on the iOS project and select Show IPA file on Build Server
A Finder window will open on the Mac with the ipa file being preselected.
Copy the file to some location that you can access easily (e.g. your Dekstop)
Open the Terminal
Write the following command: xcrun altool --upload-app --type ios --file "path/to/application.ipa" --username "YOUR_ITMC_USER" --password "YOUR_ITMC_PASSWORD"
If your application is on the Desktop, the path will look like this: ~/Desktop/application.ipa, where application.ipa is your app's name. Of course, you have to provide your credentials instead of YOUR_ITMC_USER & YOUR_ITMC_PASSWORD .
When you have run this command, wait a minute or two. After a while the tool will tell you if the upload fails and if so - why exactly.
P.S. You can also use the GUI Transporter app, but I don't know how much more information it may give you.
Make sure:
You use App Specific Password.
Make sure you INCREACE THE VERSION AND THE BUILD NUMBERS in info.plist
I used the Transporter App because nothing else was working. The upload failed again, but Transporter actually showed a great error message... my build version number had to be updated in Info.plist (oops!).
After updating the version number and re-archiving, the Distribute button worked as intended.
To use the Transport App
Download Transport App (made by Apple) from App store and open it on the mac
Build the iOS project in release mode on Visual Studio
Right-click the iOS project in Visual Studio and Show IPA on Build Server
If Show IPA on Build Server is greyed-out/disabled navigate to the file directly on your mac instead...
Open Finder
Click Go > Go to Folder... on the toolbar
enter ~/Library/Caches/Xamarin/mtbs/builds/
Continue navigating to the release folder... {app name}/bin/{iPhone}/Release
Find the file with the .ipa extension
Drag the IPA file into the open Transporter app
Click Deliver
If failed, click the Issue button to see why
With the most recent VS 2019 on Windows and Xcode on Mac, Show IPA file on Build was not highlighted nor was the icon for it in the menu bar. But when I launched VS again the both were highlighted and the folder displayed on the Mac when executed. Perhaps there is a latency problem with VS where you need to restart it for the feature to work.
I got this (fairly cryptic) error message when I was using an incorrect "App Specific Password".

Visual Studio Mac error MT1006 with valid/correct provisioning file

Trying to deploy a binary from Visual Studio Mac to a brand new iPad. I am using exactly the same Signing Authority and Provisioning Profile and entitlements file I have been using to push the app to the App Store since August.
Even with the correct provisioning data (I push to the App Store from this same Mac Mini) I get the dreaded MT1006 error:
ApplicationVerificationFailed: Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.3Eku4r/extracted/my.iOS.app : 0xe8008015 (A valid provisioning profile for this executable was not found.)
error MT1006: Could not install the application '/Users/john/Projects/[...]/bin/iPhone/Release/my.iOS.app' on the device 'John???s iPad': AMDeviceSecureInstallApplicationBundle returned: 0xe8008015.
Is there some extra step I am missing? What do I need to do to run the debug and release versions of my app on this iPad from Visual Studio?
The provisioning profiles for deployment to the App Store and debug deployment to a device are entirely distinct entities. Who knew? Went with Automatic Provisioning in Visual Studio, works fine. FYI.

How to sign and notarize an electron application build using visual studio code for macOS for outside mac app store?

I've created an electron application using visual studio code to publish outside mac app store. Before the macOS 10.14.4 release, my application was build and signed successfully using electron-osx-sign module which uses electron-forge internally. Now after macOS update I'm getting error message while building the application as - "rejected source = Unnotarized Developer ID".
I'm finding solutions available for application build in Xcode all over the internet but there is no specific solution for applications build in visual studio code using javascript.
The command I'm using to create a build for my macOS :
"electron-packager . appName --overwrite --platform=darwin --arch=x64 --electron-verison=5.0.1 -icon=icon.icns --osx-sign"
Kindly provide with your inputs for any possible solution.
TL;DR
For me, changing the password to app specific password resolved this error.
Explanation
App Store Connect now requires two-factor authentication (2FA) on all accounts, so you must create an app-specific password for Notarisations tools also.
How to create app-specific password: https://support.apple.com/en-us/HT204397)
Why you need app-specific password: https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/customizing_the_notarization_workflow?language=objc#3087734
(By the way, the “Unnotarized Developer ID” warning will still be showing because electron process checks the staple before notarizing, but then it will continue and the build will complete)

Using VSTS to build and deploy ionic app to both android and IOS

I have a ionic v1 app that I am trying to create both an android and ios version of the app using a Visual Studio Team Services build definition. The app builds out for both ios and android. I am now howerver having trouble with the Xcode IOS build of the app.
ionic cordova build ios --release
The above command creates the ios platform along with the xcode project and workspace file.
I then have the following VSTS XCode tasks to try build the ipa file for the ios app.
I have created both the p12 cert and provisioning profile and added them to the project. Both of which pass when running the build definition.
Here is my Xcode build configuration
The build definition fails at this point with the following erros
Code Signing Error: App has conflicting provisioning settings. App is automatically signed for development, but a conflicting code signing identity iPhone Distribution has been manually specified. Set the code signing identity value to "iPhone Developer" in the build settings editor, or switch to manual signing in the project editor.
and
Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.1'
After trying both manual and automatic signing with no joy, I finally got it to work with a few minor tweaks.
When installing the apple certificate, select temporary keychain and supply a password. If you don't use this the build agent will be waiting for user input to type the keychain password causing the build to timeout.
Switch to manual signing.
In the apple certificate install task and the Xcode build task to set the "Certificate Signing Identity" equal to the full name of the cert including the team name in brackets.
In my case, I was able to build, archive and export the ionic iOS App integrating a build.json file in the project structure, at root level:
{
"ios": {
"release": {
"codeSignIdentitiy": "iPhone Distribution: TEAM_NAME (TEAM_ID)",
"developmentTeam":"TEAM_ID",
"provisioningProfile": "UUID",
"packageType": "ad-hoc"
}
}
}
Notice that in my case I wanted to generate and ad-hoc distribution, but you can generate the app for the store, development or enterprise distribution.
Once the project is prepared and built, an exportOptions.plist file is generated in the iOS Cordova project with all the configuration to export the app and generate the IPA file.
Take a look at the cordova documentation about using build.json here: https://cordova.apache.org/docs/en/latest/guide/platforms/ios/
Then, In the Xcode VSTS task, I followed all the recommendations from #psyco :
Manual signing using the full name for the signing identity and the provisioning profile UUID.
Also take into account that for the provisioning profile name, Xcode 9 (the one used by default on VSTS Mac OS Agents at this moment) does not accept Xcode-generated Provisioning Profile (with "XC iOS" in the name), mine was like that and was weird to find the solution, thanks to Cœur
Xcode 9: Provisioning profile is Xcode managed, but signing settings require a manually managed profile
With all those things, finally I was able to do it, and also to send the IPA to App Center using another VSTS task, so the IC cycle was completed.

How does an Xcode Bot choose the certificate used to sign an .ipa if everything is set to "Automatic"?

As per this Apple article, I have set up my project to automatically code sign.
A Bot set to run a scheme using the "Release" configuration builds an archive which uploads to TestFlight fine (via pilot.)
A Bot set to run a scheme using the "Debug" configuration builds, but fails to upload to TestFlight because of a certificate error. Inspecting the .ipa, its embedded.mobileprovision contains a development certificate.
Why? What makes Xcode decide to use a Development certificate for Debug builds and a Distribution certificate for Release builds?
The debug builds use the iOS Team Provisioning Profiles. If you set the team on the Xcode portion of the Server app, it automatically downloads all the profiles to the right directory in your system for the bot to locate them. Otherwise you have to copy them manually to the /library/developer/xcodeserver/provisioning profile directory.

Resources