Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Documentation to Sign and Upload Mac Catalyst to AppStore #1187

Closed
rstolpe opened this issue Jan 9, 2023 · 9 comments
Closed

Add Documentation to Sign and Upload Mac Catalyst to AppStore #1187

rstolpe opened this issue Jan 9, 2023 · 9 comments
Labels
doc-enhancement Improve the current content [org] Pri3

Comments

@rstolpe
Copy link

rstolpe commented Jan 9, 2023

Description

You can see the guide below how to upload your Maccatalyst app to App Store.

Before you start with this guide make sure that you have created a MAUI project/app we need some things from it in this guide.
Some things to know.

  • You can’t open the app or install it from the Release folder on your system, you will get an error when trying to open it. But that’s nothing to worry about. When you later install it from App Store or TestFlight it will work fine.
  • You will get errors telling you the following when you run the “Release build” - “Can not execute /PATHTOYOURAPP/APPNAME.exe This selected execution mode is not supported for .NET projects”
I don’t know why this is coming up but it will not affect your release build and well we are on macOS so we can’t launch .EXE file. My guess is that this is a bug.
  • If you change anything in the “Capabilities” under “Identifieras” you might need to add them to your “Entitlements.plist” file in your MAUI project/app.
  1. Login to Apple Developer portal
  2. Click “Account”
  3. Under “Certificates, Identifiers & Profiles” click on “Certificates”.
    1. Create the following certifications
      1. Mac Installer Distribution
      2. Apple Distribution
    2. And remember to download and open them on your Mac so it get added to KeyChain on your computer.
  4. Go back to “Certificates, Identifiers & Profiles” and click on “Identifieras”
    1. Click on the + sign on the left on the subtitle “Identifieras.
    2. Select “App IDs”
    3. Select “App” as type
    4. Now we are going to fill some things out, remember that Capabilities and App Services can be changed later but not the Bundle ID.
    5. Fill out an Bundle ID best practices is something like com.YOURDOMAIN.appname you can replace com with se or similar, just make sure to match your domain.
    6. Write a description you like and then click “Continue”
  5. Now when your App ID are created we are going to make some changes in the “Capabilities”.
    1. Click on “Identifiers” under “Certificates, Identifiers & Profiles” you should see your App ID listed here that you have created in the steps above.
    2. Click on it.
    3. Scroll down to the bottom in the “Capabilities”.
    4. Check the box infront of “Mac Catalyst” and then click on “Configure” button.
    5. Now check “Use existing Mac App ID”
    6. Click on the dropdown for “App ID” and then select your App ID.
    7. Click “Save” and then in the main window you also click on “save” button up at the right.
  6. Now go back to “Certificates, Identifiers & Profiles” then click on “Profiles”.
    1. Here you need to create two profiles, one for iOS and one for macOS. Let’s start with the iOS one.
      1. Click on the + sign on the left on the subtitle “Profiles”.
      2. Under “Distribution” select “App Store”
      3. Now you select the App ID of the Profile you created earlier.
      4. Select your certification that looks something like this: “ (Distribution)For use in Xcode 11 or later”
      5. Name your profile and click on “Generate”, remember this because we need the name later.
    2. Now we are going to create a profile for macOS.
      1. Click on the + sign on the left on the subtitle “Profiles”.
      2. Under “Distribution” select “Mac App Store”
      3. Now select “Mac Catalyst” as your profile type and as “App ID” you should select your profile that you created earlier that should be list under the subsection “Enabled App IDs with an associated application identifier”
      4. Save the profile
  7. Go back to Developer portal and then click on “Apps” under “App Store Connect”.
    1. Click on the + sign on the right of the subtitle “Apps”
    2. Click on “New App”
    3. Now check both iOS and macOS under Platforms
    4. Write your name, primary language and select your “Bundle ID” that we did create earlier.
    5. SKU is the “ApplicationIdGuid” that you can find in your .csproj file that was created when you did create a MAUI project. This is uniq for your project/app
    6. User Access should be set to “Full Access”
    7. Click on “Create”
  8. Now we need to add some things in your app in the App Store Connect, without it Apple will not accept your upload.
    1. At the left you should see “iOS App” and “macOS App” you need to do the following on both sections.
    2. Click on the 1.0 Prepare for Submission under the OS
    3. Fill out Support URL, Marketing URL, Version, Copyright
    4. Scroll down and under “App Review Information” uncheck “Sign-in required” and then fill out the Contact Information.
    5. Scroll up and under the “Save” button select your language.
    6. Under “General” you should fill out the following
      1. App Information
        1. Fill out the following: Name, Category, Content Rights, Age Rating, Licens Agreement.
        2. Click “Save”
      2. Under “Pricing and Availability”
        1. Fill out the following: Price, Availability
        2. Click “Save”
  9. Now we are done with Apple Developer for now.
  10. xCode on your Mac
    1. Click on “Xcode” up in top menu that are located on the right of the Apple.
    2. Click “Settings”
    3. Under “Accounts” you should add your Apple ID if you don’t already have it there.
    4. Click on the button “Download Manual Profiles” wait until all of them are downloaded, it will appear a blue loading circle on the left of “Download Manual Profiles” button. When that’s gone all of them are downloaded.
    5. Now you can close xCode
  11. MAUI Project/App, we need to make some changes. It’s critical that you do as it’s say below.
    1. In your .csproj file you need to change/ add the following.
      1. ApplicationTitle should be your App name
      2. ApplicationID should be your Apple Bundle ID like com.YOURDOMAIN.appname
      3. Fill out ApplicationDisplayVersion (App Version like 1.0 or similar. and ApplicationVersion (Build number).
      4. You need to create two PropertyGroup for Maccatalyst, one for “Release” and one for “Debug”
        1. Debug
        2. Release

	<PropertyGroup Condition="$(TargetFramework.Contains('-maccatalyst')) and '$(Configuration)' == 'Debug'">
		<MtouchLink>none</MtouchLink>
		<EnableCodeSigning>false</EnableCodeSigning>
		<ProvisionType>Manual</ProvisionType>
		<CreatePackage>false</CreatePackage>
		<EnablePackageSigning>true</EnablePackageSigning>
		<CodesignKey>Apple Distribution: YOURNAME (*******)</CodesignKey>
		<CodesignEntitlements>Platforms\MacCatalyst\Entitlements.plist</CodesignEntitlements>
		<CodesignProvision>YOUR PROFILE NAME</CodesignProvision>
		<PackageSigningKey>3rd Party Mac Developer Installer: YOURNAME (*******)</PackageSigningKey>
		<UseHardenedRuntime>false</UseHardenedRuntime>
	</PropertyGroup>
	<PropertyGroup Condition="$(TargetFramework.Contains('-maccatalyst')) and '$(Configuration)' == 'Release'">
		<MtouchLink>Full</MtouchLink>
		<RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers>
		<EnableCodeSigning>True</EnableCodeSigning>
		<ProvisionType>Manual</ProvisionType>
		<CreatePackage>true</CreatePackage>
		<EnablePackageSigning>true</EnablePackageSigning>
		<CodesignEntitlements>Platforms\MacCatalyst\Entitlements.plist</CodesignEntitlements>
		<CodesignKey>Apple Distribution: YOURNAME (*******)</CodesignKey>
		<CodesignProvision>YOUR PROFILE NAME</CodesignProvision>
		<PackageSigningKey>3rd Party Mac Developer Installer: YOURNAME (*******)</PackageSigningKey>
		<UseHardenedRuntime>true</UseHardenedRuntime>
	</PropertyGroup>
2. You need to create a file named “Entitlements.plist” under “Plattforms/MacCatalyst”
4. Add the following to it, this is the minimum that are needed for the app to work.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.security.app-sandbox</key>
		<true/>
		<key>com.apple.security.network.client</key>
		<true/>
	</dict>
</plist>

6. Now we need to go and add some things in the “Info.plist” file that are located under “Plattforms/MacCatalyst”.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>NSHumanReadableCopyright</key>
	<string>© 2023, ******.</string>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>UIDeviceFamily</key>
	<array>
		<integer>2</integer>
	</array>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>arm64</string>
	</array>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>XSAppIconAssets</key>
	<string>Assets.xcassets/appicon.appiconset</string>
	<key>ITSAppUsesNonExemptEncryption</key>
	<false/>
	<key>LSApplicationCategoryType</key>
	<string>public.app-category.utilities</string>
</dict>
</plist>

Now you can run the Release building in vsCode or VS2022 and then upload it to Apple with Transporter application. Enjoy!

Public API Changes

That you re-write this guide and upload it to your docs, you don't need to re-write it but I might have some misspellings etc. in it.

Intended Use-Case

For users that want to upload there signed Maccatalyst app to App Store.

@jfversluis
Copy link
Member

Thanks for putting this together!

We have docs in this area already published here. Is there any reason that you didn't open an issue there? Or even better, open a PR there to make it part of the docs.

@jfversluis jfversluis changed the title Guide, (inside this post) how to upload sign maccatalyst to AppStore. Add Documentation to Sign and Upload Mac Catalyst to AppStore Jan 9, 2023
@rstolpe
Copy link
Author

rstolpe commented Jan 9, 2023

Thanks for putting this together!

We have docs in this area already published here. Is there any reason that you didn't open an issue there? Or even better, open a PR there to make it part of the docs.

I did just miss that :)

@akhanalcs
Copy link

Step by step guide like this on Official docs would be great!

@datvm
Copy link

datvm commented Jan 10, 2023

So following this guide, I could finally get through the Transporter and upload to the store. However, trying TestFlight internal testing, the app crashes on startup. The app is just a simple template project. Was you able to test it?

@rstolpe
Copy link
Author

rstolpe commented Jan 10, 2023

Look> So following this guide, I could finally get through the Transporter and upload to the store. However, trying TestFlight internal testing, the app crashes on startup. The app is just a simple template project. Was you able to test it?

Yes, I do run my app trough TestFlight internal testing.

Make sure that you have the correct entitlements for your app and also the correct info.plits.
Sometime settings in the .project file can interfere with info.plist.

Also, when you build your app for release it's strips the code according to SDKOnly as default don't remember the correct name but make sure that your 3rd party Libs if you have any are working with that.
I have stumbled over Libs that don't work and then I need to adjust the code etc.

I did see now that Full are on full for the release you should change that to SDK or if it's SDKOnly I can't remember

@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Jan 10, 2023
@rachelkang rachelkang transferred this issue from dotnet/maui Jan 10, 2023
@rachelkang rachelkang transferred this issue from dotnet/docs Jan 10, 2023
@davidbritch davidbritch added doc-enhancement Improve the current content [org] and removed ⌚ Not Triaged Not triaged labels Jan 11, 2023
@davidbritch
Copy link
Contributor

Closing this issue because it's a dupe of #938 and #677. This issue is full of great info which'll get incorporated into the docs when #938 and #677 are dealt with.

@moilotus
Copy link

Hi,

I've been building a macOS Catalyst app and pushing it to TestFlight using a GitHub Action for the last few months - all using a TestFlight Internal Testing group. The build system through to testing has worked fine.

The first time I have tried to promote a build to an External Group to beta test with some customers, TestFlight reports: "This build is using a beta version of Xcode and can’t be submitted.". It would appear that TestFlight Internal distribution groups can use beta software, but external groups can't. Seems sensible.

That seems clear enough, but the runner uses the latest released XCode. I've tried from an earlier runner using XCode 13 and my local machine on XCode 14.2 - same result.

I've then tried a Maui Hello World app - same issue. I then built Hello World on my machine in Swift (So same XCode as used to build the Maui Hello World that failed to promote), uploaded that using the same command line commands, and that works fine.

From my perspective at the moment, it looks like a Maui app is looking to TestFlight as if its been built using beta software, but I can't think why.

Can anyone confirm if they can promote their TestFlight builds to an External Group?

My basic build script:
dotnet build MyApp/MyApp.csproj -f:net7.0-maccatalyst -c:Release /p:CreatePackage=true
 
codesign --entitlements MyApp/Platforms/MacCatalyst/Entitlements.plist -f -s “*****” "MyApp/bin/Release/net7.0-maccatalyst/MyApp-0.3.581.pkg" 
 
Check:

codesign -d --entitlements - --xml "MyApp/bin/Release/net7.0-maccatalyst/MyApp-0.3.581.pkg" | plutil -convert xml1 -o - -
 
productsign --sign "3rd Party Mac Developer Installer: ***” MyApp/bin/Release/net7.0-maccatalyst/MyApp-0.3.581.pkg MyApp/bin/Release/net7.0-maccatalyst/MyApp-signed.pkg
 
xcrun altool --upload-package ./MyApp/bin/Release/net7.0-maccatalyst/MyApp-signed.pkg --apiKey ***** --apiIssuer ***** --type osx --asc-public-id ***** --apple-id **** --bundle-id com.
.MyApp --bundle-short-version-string '0.3.581' --bundle-version 581

image

Many thanks for any help or pointers.

Graham

@cdavidyoung
Copy link

I get to step 11 but am a little unsure of

	<CodesignKey>Apple Distribution: YOURNAME (*******)</CodesignKey>
	<CodesignProvision>YOUR PROFILE NAME</CodesignProvision>

I figure YOUR PROFILE NAME is the name of the profile that we just created on the Profiles tab. Is YOURNAME (*******) actually my name followed by my App ID Prefix in ()?

Thanks

@cdavidyoung
Copy link

I am still getting "No valid Provisioning Profile found" when I try to Sign and Distribute from the Archives in VS2022. I am pretty sure it is caused by my lack of understanding of these lines. Perhaps in your instructions you could refer back to the specific step where the information can be found?

	<CodesignKey>Apple Distribution: YOURNAME (*******)</CodesignKey>
	<CodesignEntitlements>Platforms\MacCatalyst\Entitlements.plist</CodesignEntitlements>
	<CodesignProvision>YOUR PROFILE NAME</CodesignProvision>
	<PackageSigningKey>3rd Party Mac Developer Installer: YOURNAME (*******)</PackageSigningKey>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-enhancement Improve the current content [org] Pri3
Projects
None yet
Development

No branches or pull requests

8 participants