Skip to content

Publish a Mac Catalyst app to the App Store #938

Closed

Description

@davidbritch

At the moment the publish a Mac app doc is CLI only, for unsigned apps.

The story for Mac Catalyst publishing is that it's not possible on Windows, but it is possible on a Mac. However, it's not currently possible as an end-to-end scenario in VSMac. The solution is:

  1. Create certs in your Apple Developer Account.
  2. Use the Apple developer portal to create the App ID and provisioning profile.
  3. Set entitlements, depending on your distribution channel.
  4. Edit your .csproj to add the required build properties (which are different depending on how you're distributing your app).
  5. Use the CLI to publish the app.

This approach requires an Apple Distribution certificate, and a Mac Installer certificate.

Create a doc that covers distribution to the App Store using this approach.

Note: this distribution channel is only an option for individual Apple accounts.


Associated WorkItem - 66534

Activity

  1. added
    Pri1
    and removed on Feb 23, 2023
  2. self-assigned this
    on Feb 23, 2023
  3. added
    doc-idea
    on Feb 23, 2023
  4. changed the title [-]VSMac: Publish a Mac app[/-] [+]VSMac: Publish a Mac Catalyst app[/+] on Feb 28, 2023
  5. changed the title [-]VSMac: Publish a Mac Catalyst app[/-] [+]Publish a Mac Catalyst app[/+] on Feb 28, 2023
  6. changed the title [-]Publish a Mac Catalyst app[/-] [+]Publish a Mac Catalyst app to the App Store[/+] on Feb 28, 2023
  7. added
    🗺️ reQUEST
    on Feb 28, 2023
  8. removed
    🗺️ reQUEST
    on Feb 28, 2023
  9. 35 remaining items

  10. davidbritch commented on Mar 30, 2023

    @davidbritch
    ContributorAuthor

    Your entitlements look good. I was just checking you had <key>com.apple.security.network.client</key>. So the next area to look at is your Info.plist file. Is your app doing anything like using maps, getting location, accessing the file system?

  11. davidbritch commented on Mar 30, 2023

    @davidbritch
    ContributorAuthor

    Here's my thinking, so you know where I'm coming from. TCC_CRASHING_DUE_TO_PRIVACY_VIOLATION usually occurs because the app is attempting to access privacy-sensitive data without a usage description for it in Info.plist. So depending on what you're app is actually doing (maps, location, file system, photos, camera etc.) you may well be missing an Info.plist entry. It's often the case that they aren't required for debug builds, but are for release builds.

  12. davidbritch commented on Mar 30, 2023

    @davidbritch
    ContributorAuthor

    Something else to try is to comment out the PropertyGroup in your .csproj for your release config, to stop the code-signing etc. Then run a freshly built release build (having deleted bin/obj first) and see if you get anything that indicates a missing Info.plist key/description.

  13. cdavidyoung commented on Mar 30, 2023

    @cdavidyoung

    @davidbritch Here is my Info.plist file. It has the same list of access that my iOS app has that is currently live on the App Store.

    Thanks for all your help, BTW! This stuff is so confusing.

    As far as maps, location, file system, photos, camera, etc, yes I do them all in this app. I also record and play audio.

    Looking at your last recommendation, after I do the release build do you mean you want me to try and publish it to the App Store?

    <?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>LSApplicationQueriesSchemes</key>
      <array>
        <string>mailto</string>
      </array>
    	<key>NSHumanReadableCopyright</key>
    	<string>© 2023, ******.</string>
    	<key>CFBundleDevelopmentRegion</key>
    	<string>en</string>
    
    	<key>UIDeviceFamily</key>
    	<array>
    		<integer>1</integer>
    		<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>UIInterfaceOrientationPortraitUpsideDown</string>
    		<string>UIInterfaceOrientationLandscapeLeft</string>
    		<string>UIInterfaceOrientationLandscapeRight</string>
    	</array>
    	<key>XSAppIconAssets</key>
    	<string>Assets.xcassets/appicon.appiconset</string>
    	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    	<string>The CacheAll app needs your location to create a GPS Catch.  It is only visible within the app.</string>
    	<key>NSLocationAlwaysUsageDescription</key>
    	<string>The CacheAll app needs your location to create a GPS Catch.  It is only visible within the app.</string>
    	<key>NSLocationWhenInUseUsageDescription</key>
    	<string>The CacheAll app needs your location to create a GPS Catch.  It is only visible within the app.</string>
    	<key>NSCameraUsageDescription</key>
    	<string>The CacheAll app needs access to the camera to add a photo to a Catch.</string>
    	<key>NSMicrophoneUsageDescription</key>
    	<string>The CacheAll app needs access to the microphone to add audio to a Catch.</string>
    	<key>NSPhotoLibraryAddUsageDescription</key>
    	<string>The CacheAll app needs access to the photo gallery to add a photo to a Catch.</string>
    	<key>NSPhotoLibraryUsageDescription</key>
    	<string>The CacheAll app needs access to the photo gallery to add a photo to a Catch.</string>
    	<key>CFBundleIdentifier</key>
    	<string>com.CacheAll</string>
    	<key>CFBundleDisplayName</key>
    	<string>CacheAll</string>
    	<key>CFBundleShortVersionString</key>
    	<string>0.0.31</string>
    
    	<key>ITSAppUsesNonExemptEncryption</key>
    	<false/>
    	<key>LSApplicationCategoryType</key>
    	<string>public.app-category.utilities</string>
    </dict>
    </plist>
    
    
  14. cdavidyoung commented on Mar 30, 2023

    @cdavidyoung

    @davidbritch So I commented out the PropertyGroup in my .csproj for my release config and I was able to Start Without Debugging. It would not allow me to Start Debugging. This is an improvement, but it runs perfectly normally with no hint of a a missing Info.plist key/description. I was able to take a photo and record audio without a problem. Of course, the GPS does not work on the Mac but the standard Apple map comes up fine and plots markers of photos that I have recorded with my iPhone.

  15. cdavidyoung commented on Mar 31, 2023

    @cdavidyoung

    @davidbritch Here is the change to the .csproj file with the release commented out. The debug config runs fine in the debugger.

    	<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: Charles Young (83Q3M48Y8B)</CodesignKey>
    		<CodesignEntitlements>Platforms\MacCatalyst\Entitlements.plist</CodesignEntitlements>
    		<CodesignProvision>CacheAll CacheAll Mac App Store</CodesignProvision>
    		<PackageSigningKey>3rd Party Mac Developer Installer: Charles Young (83Q3M48Y8B)</PackageSigningKey>
    		<UseHardenedRuntime>false</UseHardenedRuntime>
    	</PropertyGroup>
    <!--	<PropertyGroup Condition="$(TargetFramework.Contains('-maccatalyst')) and '$(Configuration)' == 'Release'">
    		<MtouchLink>SdkOnly</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: Charles Young (83Q3M48Y8B)</CodesignKey>
    		<CodesignProvision>CacheAll CacheAll Mac App Store</CodesignProvision>
    		<PackageSigningKey>3rd Party Mac Developer Installer: Charles Young (83Q3M48Y8B)</PackageSigningKey>
    		<UseHardenedRuntime>true</UseHardenedRuntime>
    	</PropertyGroup>-->
    
    
  16. cdavidyoung commented on Apr 2, 2023

    @cdavidyoung

    @davidbritch So I am still trying to figure out why the FlightTest app is quietly quitting without a crash report. I just want to point out that I think I initially addressed the TCC_CRASHING_DUE_TO_PRIVACY_VIOLATION when I fixed the thread #5 crash which was apparently caused by a xaml problem.

    As you suggested, commenting out the release configuration allows the app to run fine locally. So it must have something to do with the provisioning, right? Apple is just not signing it in a way that allows it to run from FlightTest.

  17. davidbritch commented on Apr 3, 2023

    @davidbritch
    ContributorAuthor

    The following entries aren't required in your release config:

    • maccatalyst-x64;maccatalyst-arm64 - this is the default for release configs, hence doesn't have to be explicitly enabled.
    • Manual - this is inferred from other settings.
    • true - this isn't required for Mac App Store apps.

    I noticed you were using the hardened runtime last week, but didn't think it would be necessarily causing a problem. Then I read this:

    "The Hardened Runtime is a collection of system-enforced restrictions that disable a set of functional capabilities, such as loading third-party frameworks, and prohibit access to restricted resources, such as the device’s built-in camera, to prevent certain classes of exploits from compromising the runtime integrity of your macOS app. If your app relies on something the Hardened Runtime restricts, you remove that specific protection by adding an entitlement to your app’s entitlements file. Xcode’s Hardened Runtime capability provides an easy way to manage those entitlements." - from https://developer.apple.com/documentation/xcode/configuring-the-hardened-runtime

    So because you've enabled the hardened runtime, you've disabled the ability to access the camera. Your app wants that access which maybe what's causing your privacy violation.

  18. davidbritch commented on Apr 3, 2023

    @davidbritch
    ContributorAuthor

    Also, in your Info.plist:

    	<key>UIDeviceFamily</key>
    	<array>
    		<integer>1</integer>
    		<integer>2</integer>
    	</array>
    

    Should just be:

    	<key>UIDeviceFamily</key>
    	<array>
    		<integer>2</integer>
    	</array>
    

    See https://learn.microsoft.com/en-gb/dotnet/maui/mac-catalyst/deployment/publish-app-store?view=net-maui-7.0#specify-the-user-interface-idiom

    In fact, the UIDeviceFamily definition in your Info.plist file prevented me from even uploading an app to the App Store with Transporter (at the same time, I don't have the hardened runtime enabled for my app).

  19. cdavidyoung commented on Apr 3, 2023

    @cdavidyoung

    @davidbritch Thanks for the new things to try. I can report a little bit of progress. At least now when it crashes it gives me a crash report! Of course I did a clean all and deleted obj/bin before doing the publish.

    dotnet publish -f:net7.0-maccatalyst -c:Release

    It looks like I am missing a library. Here is my config and a snippet from the crash report.

    
    	<PropertyGroup Condition="$(TargetFramework.Contains('-maccatalyst')) and '$(Configuration)' == 'Release'">
    		<MtouchLink>SdkOnly</MtouchLink>
    		<RuntimeIdentifiers></RuntimeIdentifiers>
    		<EnableCodeSigning>True</EnableCodeSigning>
    		<ProvisionType></ProvisionType>
    		<CreatePackage></CreatePackage>
    		<EnablePackageSigning>true</EnablePackageSigning>
    		<CodesignEntitlements>Platforms\MacCatalyst\Entitlements.plist</CodesignEntitlements>
    		<CodesignKey>Apple Distribution: Charles Young (83Q3M48Y8B)</CodesignKey>
    		<CodesignProvision>CacheAll CacheAll Mac App Store</CodesignProvision>
    		<PackageSigningKey>3rd Party Mac Developer Installer: Charles Young (83Q3M48Y8B)</PackageSigningKey>
    		<UseHardenedRuntime></UseHardenedRuntime>
    	</PropertyGroup>
    
    

    Crashed Thread: 0

    Exception Type: EXC_CRASH (SIGABRT)
    Exception Codes: 0x0000000000000000, 0x0000000000000000

    Termination Reason: Namespace DYLD, Code 1 Library missing
    Library not loaded: @executable_path/../MonoBundle/libSystem.IO.Compression.Native.dylib
    Referenced from: <98C66449-3327-3656-BD30-6FBF749806F7> /Users/USER/*/CacheAll.app/Contents/MacOS/CacheAll
    Reason: tried: '/System/Volumes/Preboot/Cryptexes/OS@executable_path/../MonoBundle/libSystem.IO.Compression.Native.dylib' (no such file), '/usr/lib/libSystem.IO.Compression.Native.dylib' (no such file, not in dyld cache), (security policy does not allow @ path expansion)
    (terminated at launch; ignore backtrace)

    Thread 0 Crashed:
    0 dyld 0x19d437190 __abort_with_payload + 8
    1 dyld 0x19d441a00 abort_with_payload_wrapper_internal + 104
    2 dyld 0x19d441a34 abort_with_payload + 16
    3 dyld 0x19d3d00a4 dyld4::halt(char const*) + 328
    4 dyld 0x19d3cd098 dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 4204
    5 dyld 0x19d3cbdc4 start + 2404

  20. cdavidyoung commented on Apr 3, 2023

    @cdavidyoung

    @davidbritch dotnet/macios#14686 covers this issue. There seems to be a solution but I am a little unsure how to implement it.

  21. cdavidyoung commented on Apr 3, 2023

    @cdavidyoung

    @davidbritch I tried to implement their fix but I am still getting the same error. Perhaps I am not putting the 2 lines in the right place?

    <PropertyGroup Condition="$(TargetFramework.Contains('-maccatalyst')) and '$(Configuration)' == 'Release'">
    		<MtouchLink>SdkOnly</MtouchLink>
            <_LibMonoLinkMode>Static</_LibMonoLinkMode>
            <_LibXamarinLinkMode>Static</_LibXamarinLinkMode>
            <RuntimeIdentifiers></RuntimeIdentifiers>
    		<EnableCodeSigning>True</EnableCodeSigning>
    		<ProvisionType></ProvisionType>
    		<CreatePackage></CreatePackage>
    		<EnablePackageSigning>true</EnablePackageSigning>
    		<CodesignEntitlements>Platforms\MacCatalyst\Entitlements.plist</CodesignEntitlements>
    		<CodesignKey>Apple Distribution: Charles Young (83Q3M48Y8B)</CodesignKey>
    		<CodesignProvision>CacheAll CacheAll Mac App Store</CodesignProvision>
    		<PackageSigningKey>3rd Party Mac Developer Installer: Charles Young (83Q3M48Y8B)</PackageSigningKey>
    		<UseHardenedRuntime></UseHardenedRuntime>
    	</PropertyGroup>
    
  22. davidbritch commented on Apr 4, 2023

    @davidbritch
    ContributorAuthor

    You need to completely remove:

                <RuntimeIdentifiers></RuntimeIdentifiers>
    	<ProvisionType></ProvisionType>
    	<CreatePackage></CreatePackage>
    	<UseHardenedRuntime></UseHardenedRuntime>
    
  23. cdavidyoung commented on Apr 4, 2023

    @cdavidyoung

    @davidbritch I tried removing those lines and I also tried using the config recommended in the link below but I am still getting the same "security policy does not allow @ path expansion" error.

    https://learn.microsoft.com/en-gb/dotnet/maui/mac-catalyst/deployment/publish-app-store?view=net-maui-7.0#specify-the-user-interface-idiom

    I think I am going to start over at the beginning of this doc and go through the whole process again. Perhaps I made a mistake the first time.

  24. cdavidyoung commented on Apr 6, 2023

    @cdavidyoung

    @davidbritch So I spent all day yesterday following the instructions in your doc but I am still getting the same error. There are some confusing parts to the doc where I may be making the wrong decisions. I'll describe them as a new issue on the doc page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

📌 seQUESTeredPri1doc-idea

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions