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

Developing a Maui Blazor MacCatalyst app for Apple macOS store is a terrible experience #12293

Closed
24 tasks done
Jinjinov opened this issue Dec 24, 2022 · 74 comments
Closed
24 tasks done
Assignees
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/macios Issues for the Mac / iOS SDK platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working User Story A single user-facing feature. Can be grouped under an epic.

Comments

@Jinjinov
Copy link

Jinjinov commented Dec 24, 2022

Description

There are many things that could be better.

Developing a MacCatalyst app:

    <EnableCodeSigning>True</EnableCodeSigning>
    <CodesignKey>3rd Party Mac Developer Application: Jinjinov (**********)</CodesignKey>
    <EnablePackageSigning>true</EnablePackageSigning>
    <PackageSigningKey>3rd Party Mac Developer Installer: Jinjinov (**********)</PackageSigningKey>

Publishing a MacCatalyst app on Apple macOS store:

  • rejected when trying to upload with Transporter: The product archive package's signature is invalid. Ensure that it is signed with your "3rd Party Mac Developer Installer" certificate. A commented section in csproj that the developer could un-comment would be helpful here.

  • rejected when trying to upload with Transporter: The product archive is invalid. The Info.plist must contain a LSApplicationCategoryType key, whose value is the UTI for a valid category. For more details, see "Submitting your Mac apps to the App Store". Some indication in Visual Studio would be helpful here. I had to add:

	<key>LSApplicationCategoryType</key>
	<string>public.app-category.productivity</string>
  • rejected when trying to upload with Transporter: Invalid bundle. The bundle supports arm64 but not Intel-based Mac computers. Your build must include the x86_64 architecture to support Intel-based Mac computers. A commented section in csproj that the developer could un-comment would be helpful here: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers>

  • rejected when trying to upload with Transporter: Invalid Bundle. The key UIDeviceFamily in the app's Info.plist file contains one or more unsupported values '1'. (ID: e98a0fc1-d792-4b2d-854c-51a5d1649c82) I had to change

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

to

	<key>UIDeviceFamily</key>
	<array>
		<integer>2</integer>
	</array>
  • rejected when trying to upload with Transporter: App sandbox not enabled. The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list Adding a Platforms/MacCatalyst/Entitlements.plist file and <CodesignEntitlement>Platforms/MacCatalyst/Entitlements.plist</CodesignEntitlement> inside csproj would be helpful here. I had to add:
<?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/>
  </dict>
</plist>

Steps to Reproduce

  1. Create a new Maui Blazor project
  2. Try to publish a Maui Blazor MacCatalyst app on Apple macOS store

Link to public reproduction project repository

https://github.com/Jinjinov/Ididit

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

macOS Ventura 13.1

Did you find any workaround?

No response

Relevant log output

No response

@Jinjinov Jinjinov added the t/bug Something isn't working label Dec 24, 2022
@akhanalcs
Copy link

Microsoft should document all the issues and solutions you figured out. And hopefully make the whole experience better.
This was a great post. Thank you!

@Eilon Eilon added the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Dec 27, 2022
@mkArtakMSFT mkArtakMSFT added area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) and removed area-blazor Blazor Hybrid / Desktop, BlazorWebView labels Dec 27, 2022
@samhouts samhouts added p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint and removed p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint labels Feb 3, 2023
@rachelkang rachelkang added this to the Backlog milestone Feb 17, 2023
@ghost
Copy link

ghost commented Feb 17, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@rachelkang rachelkang added platform/macOS 🍏 macOS / Mac Catalyst partner/macios Issues for the Mac / iOS SDK labels Feb 17, 2023
@rachelkang
Copy link
Member

@rolfbjarne thoughts on any of these issues here?

@rolfbjarne
Copy link
Member

This is great feedback! Thanks a lot!

  • adding signing to csproj results in error MSB6006: "codesign" exited with code 3.

I'm not sure what caused this, a binlog would likely be nice to diagnose.

Publishing a MacCatalyst app on Apple macOS store:

  • rejected when trying to upload with Transporter: Invalid bundle. The bundle supports arm64 but not Intel-based Mac computers. Your build must include the x86_64 architecture to support Intel-based Mac computers. A commented section in csproj that the developer could un-comment would be helpful here: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers>

Mac Catalyst will default to a universal (arm64+x64) build when building for a Release configuration (and just x64 for all other configurations).

But yes, we can add a comment to the templates as well.

For most of the other publishing issues I filed xamarin/xamarin-macios#17591 to improve our templates and build logic. @rachelkang you might want to update your MAUI templates as well.

@brightertools
Copy link

I am also trying to deploy to macOs and get things running.

This issue has helped me sign and get the app into TestFlight and distribute for testing.
dotnet/docs-maui#1187

Our app is a .net7.0, (non Blazor) MAUI app for windows/macOs, compiled on Monterey Intel mac and but crashes on another machine (Ventura M1 arm mac), this is all I have to test at the mo, so trying to work that out.

@cdavidyoung
Copy link

@brightertools , since you have gotten dotnet/docs-maui#1187 to work, perhaps you could help me understand what to use for YOURNAME (*******) and YOUR PROFILE NAME.

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

For what it is worth, I compile and run my MacCatalyst app on my Mac Mini, which is an M1. Previously I was using a 2014 Mac Mini and it would also compile and run my MacCatalyst app. Have you tried building on your M1 Mac?

@brightertools
Copy link

@brightertools , since you have gotten dotnet/docs-maui#1187 to work, perhaps you could help me understand what to use for YOURNAME (*******) and YOUR PROFILE NAME.

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

For what it is worth, I compile and run my MacCatalyst app on my Mac Mini, which is an M1. Previously I was using a 2014 Mac Mini and it would also compile and run my MacCatalyst app. Have you tried building on your M1 Mac?

Hi @cdavidyoung

Thanks for your message.

Following the guide you will need to create the certificates (x2) and download them to your computer.
The: Apple Distribution: YOURNAME (*******) is copied from the one certificate name

The: 3rd Party Mac Developer Installer: YOURNAME (*******) is copied from the other certificate name

The profile name is the name created when creating the profile in the "Certificates, Identifiers & Profiles" section of the apple developer site.
In xode you need to login to your account and download the manual profiles.. this is the profile with the matching name I beleive.

I am developing mainly on Windows then opening on my Mac to publish (Visual Studio seems a bit slower to develop on Mac, from key commands to building and running)
I only have a Mid 2015 mac, the app uns fine locally, but does not run on either my mac or another M1 mac via TestFlight. it just crashes.. searched around and found loads of things to try but its so trial and error.

It's not straight forward what might work or not in the "sandbox" or if I am worried about that too much, given the entitlements which are not that clear.

The process of setting up a new app, just for testing and re-building the app until it fails seems like a long winded unnecessary process, but it's hard to tell if the error is build, platform, signing or code related.

@cdavidyoung
Copy link

cdavidyoung commented Mar 2, 2023 via email

@brightertools
Copy link

brightertools commented Mar 3, 2023

@cdavidyoung

Yes, ProfileName is the Name field from the "Provisioning Profile" in the apple account area.

The others I copy/pasted these certificate names exactly from the Mac's Keychain Access > My Certificates.

My apple account is an organisation account, so has the company name, when I first set up the certificates I seemed to have loads my name and company name, and at some point deleted them all and re-created them (just the 2 required) and manually downloaded the profile in xcode via Xcode > Preferences > Account > Select Admin Account > Download Manual Profiles

Settings in the project for these are:

<CodesignEntitlements>Platforms\MacCatalyst\Entitlements.plist</CodesignEntitlements>
<CodesignKey>Apple Distribution: Brighter Tools Ltd (***)</CodesignKey>
<CodesignProvision>ProfileName</CodesignProvision>
<PackageSigningKey>3rd Party Mac Developer Installer: Brighter Tools Ltd (***)</PackageSigningKey>

I will be updating my mac, the mini is a good call.

UPDATE:

Purchased Macbook Pro M2, nor cannot publish the app.. lovely... will now figure that one out first
Publish error = 1, not helpful.

And noticed running VS on windows on Parallels doesn't support MAUI..

@dustin-wojciechowski
Copy link
Contributor

dustin-wojciechowski commented Mar 16, 2023

Working through your issue here and editing as I go along.

New templates implemented in #14219 solve following issues:

<dict>
    <key>com.apple.security.get-task-allow</key>
    <true/>
</dict>

Also see this documentation.

Other MAUI issues:

Issues for VS for Mac Team:

<PropertyGroup>
    <RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier>
</PropertyGroup>

Issue for .NET Core team:

<PropertyGroup>
    <MouchLink>None</MtouchLink>
</PropertyGroup>

@dustin-wojciechowski
Copy link
Contributor

dustin-wojciechowski commented Apr 12, 2023

I'll try to address all the issues line by line here.

Note: In addition to updating the templates for MAUI MacCatalyst apps to include what is necessary for publishing, the MAUI MacCatalyst Publishing documentation has also been updated, and has additional information. You can access it at aka.ms/publish-maui-app-store.

Developing a MacCatalyst app:

It looks like the VS for Mac team was looking into this, but their followup fizzled out. I will say though when it comes to building in Visual Studio, the behavior of building only using the selected platform in the IDE will only work when the Debug target is selected in the IDE. This type of target filtering does not exist for Release. Building for release in the IDE isn't really a replacement gesture for a proper archive for publishing through the IDE or from the CLI.

It appears that the VS for Mac team have included a fix in the latest preview version of VS for Mac 2022 Preview: https://developercommunity.visualstudio.com/t/Building-IOS-Release-generate-error-the/10208351 (check last comment in thread)

It appears that this issue has to do with the iOS simulator when on M1/M2 Macs. This is a problematic issue because if we set this as a default, it could affect other libraries. We will see about getting this change into the IDE itself, but the suggested fix is to add this to the csproj within a Maui Blazor solution:

<PropertyGroup>
    <RuntimeIdentifier>iossimulator-arm64</RuntimeIdentifier>
</PropertyGroup>

It looks like this is aspnetcore's wheelhouse. I saw that you had a workaround for this, but an additional recommendation is to add this to your csproj to reduce trimming for iOS/MacCatalyst:

<PropertyGroup>
    <MouchLink>None</MtouchLink>
</PropertyGroup>
  • adding signing to csproj results in error MSB6006: "codesign" exited with code 3.

We have a fix submitted for that on the .NET for iOS side here: xamarin/xamarin-macios#17829

For both of these issues, It appears this issue occurs due to an entitlement that is automatically added and removed by Apple in Xcode during debugging. This is updated in our our templates as per #14196 , but for now, please add this to your Entitlements.plist:

<dict>
    <key>com.apple.security.get-task-allow</key>
    <true/>
</dict>

Publishing a MacCatalyst app on Apple macOS store:

  • rejected when trying to upload with Transporter: The product archive package's signature is invalid. Ensure that it is signed with your "3rd Party Mac Developer Installer" certificate. A commented section in csproj that the developer could un-comment would be helpful here.

Solution added to templates in #14196

  • rejected when trying to upload with Transporter: The product archive is invalid. The Info.plist must contain a LSApplicationCategoryType key, whose value is the UTI for a valid category. For more details, see "Submitting your Mac apps to the App Store".

Solution added to templates in #14196

  • rejected when trying to upload with Transporter: Invalid bundle. The bundle supports arm64 but not Intel-based Mac computers. Your build must include the x86_64 architecture to support Intel-based Mac computers.

Solution added to templates in #14196

  • rejected when trying to upload with Transporter: Invalid Bundle. The key UIDeviceFamily in the app's Info.plist file contains one or more unsupported values '1'. (ID: e98a0fc1-d792-4b2d-854c-51a5d1649c82)

Solution added to templates in #13910

  • rejected when trying to upload with Transporter: App sandbox not enabled. The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list

Solution added to templates in #14196

I've made a comment in this issue, but essentially this falls on an issue where Apple is not using the CFBundleDisplayName in the tool tip you get when you hover over the application in the app dock. I will file a feedback ticket to Apple to see if we can get that fixed. Unfortunately for now, it will have to rely on what is set for your Application Title.

  • I had to add ITSAppUsesNonExemptEncryption to Info.plist. Some indication in Visual Studio would be helpful here.

Solution added to templates in #14196

  • Maui Blazor template lacks entitlements necessary to submit to Apple macOS store

Solution added to templates in #14196.

I hope these changes and suggestions will help improve your experience with publishing your MAUI Blazor MacCatalyst app for the Mac App Store!

@Jinjinov
Copy link
Author

Jinjinov commented Apr 13, 2023

@dustin-wojciechowski Thank you very much for looking into this.

One of the last obstacles was #13094 but after fixing it, I still can't publish.

After these two entitlements were added, the .pkg file was successfully submitted to Apple for review, but they rejected it because the app crashed on launch. Their crash report:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @executable_path/../MonoBundle/libSystem.IO.Compression.Native.dylib
Referenced from: <DDE3A74F-055E-3EE1-94C5-8E5120BB0680> /Applications/ididit.today.app/Contents/MacOS/ididit.today
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)

@cdavidyoung
Copy link

I am getting the exact same crash report after downloading from TestFlight. I opened an issue trying to get some clarification on the documentation.

dotnet/docs-maui#1403.

@dustin-wojciechowski I have not gone through your long list of solutions yet. It is not clear whether you have been successful in publishing a Mac app. If so, was it in association with the iOS version of the same app?

@rolfbjarne
Copy link
Member

@rolfbjarne I unchecked the Mac Catalyst check box and saved the id. It warns me that the dependent profiles will become invalid and I say OK.

I go to the two affected profiles, CacheAll CacheAll and CacheAll MacCatalyst Rolf, open each, edit (with no changes), and save to make them valid again.

In Xcode I do a Download Manual Profiles to get the profiles on the Mac up-to-date. Now I build and the error is gone!

After creating the .pkg (dotnet publish -f:net7.0-maccatalyst -c:Release) Transporter will now accept and upload the MacCatalyst app.

However, when I install it from TestFlight it crashes and gives me the same exception that I was getting before and other people are encountering:

Termination Reason: Namespace DYLD, Code 1 Library missing Library not loaded: @executable_path/../../Contents/MonoBundle/libe_sqlite3.dylib Referenced from: <1353F152-FA40-37D6-A087-3765DFC05E6B> /Users/USER/*/CacheAll.app/Contents/MacOS/CacheAll Reason: tried: '/System/Volumes/Preboot/Cryptexes/OS@executable_path/../../Contents/MonoBundle/libe_sqlite3.dylib' (no such file), '/usr/lib/libe_sqlite3.dylib' (no such file, not in dyld cache), (security policy does not allow @ path expansion) (terminated at launch; ignore backtrace)

Yes, that's xamarin/xamarin-macios#14686.

There are two known workarounds: either use a Mac (not Mac Catalyst) provisioning profile, or add this to the project file: xamarin/xamarin-macios#14686 (comment).

@cdavidyoung
Copy link

@rolfbjarne I am already doing the fix to .csproj. Could you be a little more explicit about "use a Mac (not Mac Catalyst) provisioning profile". Do I need to create a new profile or modify the existing CacheAll MacCatalyst Rolf?

<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 MacCatalyst Rolf</CodesignProvision>
	<PackageSigningKey>3rd Party Mac Developer Installer: Charles Young (83Q3M48Y8B)</PackageSigningKey>
	<UseHardenedRuntime></UseHardenedRuntime>
        <!-- iOS crashing when trying to save -->
            <UseInterpreter>true</UseInterpreter>
</PropertyGroup>

@rolfbjarne
Copy link
Member

@rolfbjarne I am already doing the fix to .csproj. Could you be a little more explicit about "use a Mac (not Mac Catalyst) provisioning profile". Do I need to create a new profile or modify the existing CacheAll MacCatalyst Rolf?

<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 MacCatalyst Rolf</CodesignProvision>
	<PackageSigningKey>3rd Party Mac Developer Installer: Charles Young (83Q3M48Y8B)</PackageSigningKey>
	<UseHardenedRuntime></UseHardenedRuntime>
        <!-- iOS crashing when trying to save -->
            <UseInterpreter>true</UseInterpreter>
</PropertyGroup>

Yes, you need to create a new profile, because Apple doesn't allow you to change an existing one.

The profile should look like the second screenshot here: xamarin/xamarin-macios#14686 (comment)

@cdavidyoung
Copy link

@rolfbjarne Alright, this profile works! I can finally run from TestFlight. One caveat is that I have not tried to publish a new version of the iOS app. I don't know if anything I did here will affect that. Thanks for you help, Rolf!

image

@cdavidyoung
Copy link

cdavidyoung commented May 10, 2023

@rolfbjarne I am pleased to announce that my .net Maui Mac app, CacheAll, has been accepted on the App Store. Now my app is available for all 4 platforms. Whew.

So has documentation been updated to reflect all the correct steps necessary to publish iOS and MacCatalyst? I am not even sure that I could do it again correctly. There have been too many trials and errors even after trying to follow the current documentation https://learn.microsoft.com/en-us/dotnet/maui/mac-catalyst/deployment/?view=net-maui-7.0 several times.

@rolfbjarne
Copy link
Member

@davidbritch I think this page (https://learn.microsoft.com/en-us/dotnet/maui/mac-catalyst/deployment/?view=net-maui-7.0) needs to be updated with the findings from this issue (see previous comment).

@brightertools
Copy link

brightertools commented Jul 9, 2023

@rolfbjarne I am pleased to announce that my .net Maui Mac app, CacheAll, has been accepted on the App Store. Now my app is available for all 4 platforms. Whew.

So has documentation been updated to reflect all the correct steps necessary to publish iOS and MacCatalyst? I am not even sure that I could do it again correctly. There have been too many trials and errors even after trying to follow the current documentation https://learn.microsoft.com/en-us/dotnet/maui/mac-catalyst/deployment/?view=net-maui-7.0 several times.

Glad you got this working, I am now back onto trying to get this to work after abandoning this to get it into the Microsoft Store, I am not able to get it running via TestFlight without crashing, and logging to email to let me know what going on, the app is now running, but the UI Content Pages are not displaying.. its very much trial and error, hard to not go around in circles. How can it work in dev, and via Microsoft Store but not via TestFlight? so annoying

@cdavidyoung
Copy link

@brightertools Does your app work on iPhone or just desktops? Is your app made public on the Microsoft Store?

Regarding UI Content Pages are not displaying, I am not having that problem on the Mac but it does happen on Android. Rotating the screen will usually cause it to appear. I don't have the problem on Windows or iPhone.

@brightertools
Copy link

@brightertools Does your app work on iPhone or just desktops? Is your app made public on the Microsoft Store?

Regarding UI Content Pages are not displaying, I am not having that problem on the Mac but it does happen on Android. Rotating the screen will usually cause it to appear. I don't have the problem on Windows or iPhone.

Hi,

It's not publicaly searchable ,
but is here: https://apps.microsoft.com/store/detail/cloudrepro/9PN1X5B257GW

I am trying to deploy the same app for macOs (not interested in IOS or Android) but just cannot get it to run via TestFlight, works perfectly fine via Visual Studio on Mac. (Latest VS, Apple M2 Max)

Added NLog for Maui (nit sure where the logs go but added an email target to try and see where its fails)

There are not errors, the main page loads (as does the main ViewModel with a timer that performs some tasks) its seems the code runs on the ViewModel, timer starts and performs tasks, but no windows/UI/Pages are visible. There is no UI at all, not even any container/window, and the main menu bar has no items.

Tried various configurations of creating the Page / ViewModels (using MVVM toolbox) but cannot get it run properly on MacOS. Is working fine on windows via VS and deployed via the MS Store.

One thing I have noticed is that the App (App.xml.cs) seems to be called twice.

@cdavidyoung
Copy link

@brightertools I understand your frustration. If you read through the thread you can see that @rolfbjarne helped me finally get this working. You might ping him to see what he suggests. Good luck!

@brightertools
Copy link

@brightertools I understand your frustration. If you read through the thread you can see that @rolfbjarne helped me finally get this working. You might ping him to see what he suggests. Good luck!

There is nothing definitive about how I move forward from this point, its poking & hoping, trial and error, it shouldn't be as bad as this...
I will need to reach out if I cannot get this working, it not a great experience so far... reminds me of Flash, end result always looked good but had to jump through hoops to get there...

@brightertools
Copy link

I have been trying many things now, the app doesn't crash anymore, and there are no errors, but the XAML page just doesn't render..

It seems on MacOs the Pages and ViewModels are not Singletons, they get recreated multiple times, it looks like they get created 4 times each based on my logs.. This was creating some hanging (got one message related to something already exists [was registering a callback after setting pages loses ie WeakReferenceMessenger.Default.Register(this, (r, m)...], but no other errors many try..catch blocks that don't get hit) I moved all code from constructors to own methods and had to add an hacky init flag to get around this.

I ended up added an empty Page as the startup page with a start button, when I navigate to the MainPage now, it's blank but at east there is a UI rather than no windows associated with the app, the page must load as it loads the Viewmodel and runs tasks on a timer on that ViewModel, lots from that are being generated..

Again this app works on windows and is deployed to the Microsoft Store, I really don't get why this works in dev and not after deployment to TestFlight, the whole point of MAUI is to work cross platform with the same code.

@mike3sullivan
Copy link

Apparently there is a bug in ILStrip on MacOS that can affect some functions (a DateTime.TryParse in my case).
dotnet/runtime#85414 (comment)

The workaround is to disable ILStrip via the project file:
false

Include this until they fix the problem, or who knows what might not work properly.

@brightertools
Copy link

brightertools commented Jul 10, 2023

Apparently there is a bug in ILStrip on MacOS that can affect some functions (a DateTime.TryParse in my case). dotnet/runtime#85414 (comment)

The workaround is to disable ILStrip via the project file: false

Include this until they fix the problem, or who knows what might not work properly.

Hi @mike3sullivan

I have tried this via TestFlight, upload no. 59 :) but unfortunately hasn't had any visible results in this case, I do appreciate your reply and is good to know for future ref (and leaving it in for now)

I am contemplating making the repo public, and hesitant to reach out to individuals, I appreciate these are not all your problems....but certainly running out of logical options...

I can outline a few things in the app that might highlight anything to check:

  1. Connects to a WebAPI
  2. Settings are retrieved/saved via IPreferences
  3. Using SignalR
  4. Using Community Toolkit MVVM
  5. Using a Telerik RadItemsControl with a standard custom ContentView
  6. Using Telerik RadComboBox
  7. Using gradients in the UI
  8. Using images in the UI
  9. Using IDeviceInfo
  10. Using IDeviceDisplay
  11. Using IFileSaver (community toolkit)
  12. Using IFolderPicker (community toolkit)
  13. Using NLog Maui (and sending logs via email as I don't know where the Maui logs go)
  14. All Work on Windows, released to Windows Store

(issues existed before Telerik controls added)

@samhouts samhouts modified the milestones: .NET 8, .NET 8 GA Jul 12, 2023
@dustin-wojciechowski
Copy link
Contributor

@brightertools Would you mind making a new issue (if you haven't already) for your issue with the XAML page not rendering so that we can take a look at it a bit more closely?

@brightertools
Copy link

I started removing a load of things from the UI, until I remove all the Telerik Controls, I was using the latest version of the controls, but had to set a specific MAUI version in the project file. I was then able to see the UI, although still had issues with data loading etc..

It turns out Windows is much more forgiving when it comes to the ViewModel reference and bindings, I had to specifically set page/controls names, data types etc and carefully look at all the bindings. Also loading images (in my case via url) in item lists views (built in MAUI or Telerik controls) uses loads of memory, so watch image size served form the web.

I still have issues with the file selection and saving, still looking at that and have no idea where MAUI specific Nlog Logs go, but used an email target to debug (via testflight) which worked better than nothing.

@dustin-wojciechowski
Copy link
Contributor

Hello,

We have tried our best to alleviate as much of these issues as we had in our power to do. I encourage all developers developing Maui Blazor applications for MacCatalyst for the Apple MacOS store to give publishing another shot with the upcoming .NET 8 release. And of course, if any problems occur, please feel free to create a new issue so we can look at it.

Happy developing!

@Jinjinov
Copy link
Author

Hello @dustin-wojciechowski

Thank you for looking into this. I gave up trying to publish with .NET 7 and it was my intention to try again with .NET 8 so your announcement is really welcome.

I will give it another try with .NET 8

@brightertools
Copy link

brightertools commented Sep 20, 2023

Hello,

We have tried our best to alleviate as much of these issues as we had in our power to do. I encourage all developers developing Maui Blazor applications for MacCatalyst for the Apple MacOS store to give publishing another shot with the upcoming .NET 8 release. And of course, if any problems occur, please feel free to create a new issue so we can look at it.

Happy developing!

This is appreciated and will certainly try this..

To get the MacOs working has been very time consuming, We are developing for both MacOs and Windows desktop.. learning that Visual Studio Mac is going to be discontinued was pretty bad news since we use Visual studio for both Mac and Windows on this project. I fear more time will be spent trying to re-discover what doesnt work in VS-Code and who knows how seamless the migration will be, not to mention now having to work with either VS-Code for Mac and Visual Studio for windows or having to start setting up and using VS-Code for windows to make that seamless... its just feels like the MacOs 'terrible experience' is going to continue for some time?

Please consider the migration paths to XCode and also working on the same project with XCode and Visual Studio. Thanks.

which makes me thinks, is XCode going to replace Visual Studio on PC as well, at some point?

@ghost ghost locked as resolved and limited conversation to collaborators Oct 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) p/1 Work that is important, and has been scheduled for release in this or an upcoming sprint partner/macios Issues for the Mac / iOS SDK platform/macOS 🍏 macOS / Mac Catalyst t/bug Something isn't working User Story A single user-facing feature. Can be grouped under an epic.
Projects
None yet
Development

No branches or pull requests