From 875c122c854625b693ed20c5f1d92b4013206be9 Mon Sep 17 00:00:00 2001 From: James Crutchley Date: Sat, 5 Oct 2024 11:32:55 -0700 Subject: [PATCH 1/2] Update .gitignore and enhance Mac Catalyst instructions Updated .gitignore to ignore the .vs directory used by Visual Studio. Expanded MediaElement.md with detailed instructions for editing the Info.plist file to support multiple scenes in Mac Catalyst applications. Added keys include UIApplicationSceneManifest, UIApplicationSupportsMultipleScenes, and UISceneConfigurations with their respective configurations. --- .gitignore | 1 + docs/maui/views/MediaElement.md | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.gitignore b/.gitignore index 2359c60d..1a305311 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ _repo.*/ .openpublishing.buildcore.ps1 .DS_Store +/.vs diff --git a/docs/maui/views/MediaElement.md b/docs/maui/views/MediaElement.md index 2c1a4ac2..1c5bae35 100644 --- a/docs/maui/views/MediaElement.md +++ b/docs/maui/views/MediaElement.md @@ -135,6 +135,23 @@ For a full example of this method included in an application please refer to the Edit the `Info.plist` for `MacCatalyst` and add the following keys. ```csharp +UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + __MAUI_DEFAULT_SCENE_CONFIGURATION__ + UISceneDelegateClassName + SceneDelegate + + + + UIBackgroundModes bluetooth-central From 1305f902031ce6f1f147679e4a29cb3b2b6bcb2d Mon Sep 17 00:00:00 2001 From: James Crutchley Date: Sat, 5 Oct 2024 13:07:22 -0700 Subject: [PATCH 2/2] Add SceneDelegate class Added SceneDelegate.cs in Platforms/MacCatalyst, defining a SceneDelegate class that inherits from MauiUISceneDelegate for handling scene-related events. --- docs/maui/views/MediaElement.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/maui/views/MediaElement.md b/docs/maui/views/MediaElement.md index 1c5bae35..185094ab 100644 --- a/docs/maui/views/MediaElement.md +++ b/docs/maui/views/MediaElement.md @@ -160,6 +160,21 @@ Edit the `Info.plist` for `MacCatalyst` and add the following keys. NSLocalNetworkUsageDescription ``` +Add the following to a new file `SceneDelegate.cs` in the `Platforms/MacCatalyst` folder.` +```csharp +using System; +using Foundation; +using Microsoft.Maui; +using ObjCRuntime; +using UIKit; + +namespace CommunityToolkit.Maui.Sample.Platforms.MacCatalyst; + +[Register("SceneDelegate")] +public class SceneDelegate : MauiUISceneDelegate +{ +} +``` ### [iOS](#tab/ios)