From 4b7403549d1ca8a0322942baf997e336f4902785 Mon Sep 17 00:00:00 2001 From: jonathan schatz Date: Wed, 15 Feb 2023 10:32:26 -0800 Subject: [PATCH 1/2] add iCloud support for macos --- .../utils/juce_Entitlements.cpp | 31 +++++++++---------- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 11 ++++--- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/extras/Build/juce_build_tools/utils/juce_Entitlements.cpp b/extras/Build/juce_build_tools/utils/juce_Entitlements.cpp index c41b4db0b2..2a4d6ac815 100644 --- a/extras/Build/juce_build_tools/utils/juce_Entitlements.cpp +++ b/extras/Build/juce_build_tools/utils/juce_Entitlements.cpp @@ -51,24 +51,23 @@ namespace build_tools { if ((isAudioPluginProject && shouldEnableIAA) || isAUPluginHost) entitlements.set ("inter-app-audio", ""); + } + if (isiCloudPermissionsEnabled) + { + entitlements.set ("com.apple.developer.icloud-container-identifiers", + "\n" + " iCloud.$(CFBundleIdentifier)\n" + " "); - if (isiCloudPermissionsEnabled) - { - entitlements.set ("com.apple.developer.icloud-container-identifiers", - "\n" - " iCloud.$(CFBundleIdentifier)\n" - " "); + entitlements.set ("com.apple.developer.icloud-services", + "\n" + " CloudDocuments\n" + " "); - entitlements.set ("com.apple.developer.icloud-services", - "\n" - " CloudDocuments\n" - " "); - - entitlements.set ("com.apple.developer.ubiquity-container-identifiers", - "\n" - " iCloud.$(CFBundleIdentifier)\n" - " "); - } + entitlements.set ("com.apple.developer.ubiquity-container-identifiers", + "\n" + " iCloud.$(CFBundleIdentifier)\n" + " "); } if (isPushNotificationsEnabled) diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index 892babbdd4..8c86b1f21b 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -612,12 +612,13 @@ public: props.add (new ChoicePropertyComponent (iosAppGroupsValue, "App Groups Capability"), "Enable this to grant your app the capability to share resources between apps using the same app group ID."); - - props.add (new ChoicePropertyComponent (iCloudPermissionsValue, "iCloud Permissions"), - "Enable this to grant your app the capability to use native file load/save browser windows on iOS."); - } + + props.add (new ChoicePropertyComponent (iCloudPermissionsValue, "iCloud Permissions"), + iOS ? "Enable this to grant your app the capability to use native file load/save browser windows on iOS." : + "Enable this to grant your app the capability to use iCloud Document Storage"); + props.add (new ChoicePropertyComponent (networkingMulticastValue, "Networking Multicast Capability"), "Your app must have this entitlement to send or receive IP multicast or broadcast. " "You will also need permission from Apple to use this entitlement."); @@ -1323,7 +1324,7 @@ public: capabilities["Sandbox"] = type == Target::AudioUnitv3PlugIn || owner.isAppSandboxEnabled(); capabilities["HardenedRuntime"] = owner.isHardenedRuntimeEnabled(); - if (owner.iOS && owner.isiCloudPermissionsEnabled()) + if (owner.isiCloudPermissionsEnabled()) capabilities["com.apple.iCloud"] = true; StringArray capabilitiesStrings; From 6c4bb34e3bd3830bbc3b2898914ee033888235e9 Mon Sep 17 00:00:00 2001 From: jonathan schatz Date: Wed, 15 Feb 2023 10:59:27 -0800 Subject: [PATCH 2/2] use projectBundlerIdentifier for icloud container name --- .../juce_build_tools/utils/juce_Entitlements.cpp | 13 +++++++------ .../juce_build_tools/utils/juce_Entitlements.h | 2 +- .../ProjectSaving/jucer_ProjectExport_Xcode.h | 3 ++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/extras/Build/juce_build_tools/utils/juce_Entitlements.cpp b/extras/Build/juce_build_tools/utils/juce_Entitlements.cpp index 2a4d6ac815..aa3d913fcf 100644 --- a/extras/Build/juce_build_tools/utils/juce_Entitlements.cpp +++ b/extras/Build/juce_build_tools/utils/juce_Entitlements.cpp @@ -54,20 +54,21 @@ namespace build_tools } if (isiCloudPermissionsEnabled) { + entitlements.set ("com.apple.developer.icloud-container-identifiers", "\n" - " iCloud.$(CFBundleIdentifier)\n" - " "); + "\t\tiCloud." + projectBundlerIdentifierString.trim() + "\n" + "\t"); entitlements.set ("com.apple.developer.icloud-services", "\n" - " CloudDocuments\n" - " "); + "\t\tCloudDocuments\n" + "\t"); entitlements.set ("com.apple.developer.ubiquity-container-identifiers", "\n" - " iCloud.$(CFBundleIdentifier)\n" - " "); + "\t\tiCloud." + projectBundlerIdentifierString.trim() + "\n" + "\t"); } if (isPushNotificationsEnabled) diff --git a/extras/Build/juce_build_tools/utils/juce_Entitlements.h b/extras/Build/juce_build_tools/utils/juce_Entitlements.h index 1449998301..a528726072 100644 --- a/extras/Build/juce_build_tools/utils/juce_Entitlements.h +++ b/extras/Build/juce_build_tools/utils/juce_Entitlements.h @@ -46,7 +46,7 @@ namespace build_tools bool isNetworkingMulticastEnabled = false; String appGroupIdString; - + String projectBundlerIdentifierString; StringArray hardenedRuntimeOptions; StringArray appSandboxOptions; diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index 8c86b1f21b..a3920023c1 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -242,7 +242,7 @@ public: String getDevelopmentTeamIDString() const { return iosDevelopmentTeamIDValue.get(); } String getAppGroupIdString() const { return iosAppGroupsIDValue.get(); } - + String getProjectBundlerIdentifierString() const { return project.getBundleIdentifierString(); } String getBuildNumber() const { const auto buildNumberString = buildNumber.get().toString(); @@ -3146,6 +3146,7 @@ private: options.isAppSandboxInhertianceEnabled = isAppSandboxInhertianceEnabled(); options.isNetworkingMulticastEnabled = isNetworkingMulticastEnabled(); options.appGroupIdString = getAppGroupIdString(); + options.projectBundlerIdentifierString = getProjectBundlerIdentifierString(); options.hardenedRuntimeOptions = getHardenedRuntimeOptions(); options.appSandboxOptions = getAppSandboxOptions(); options.appSandboxTemporaryPaths = getAppSandboxTemporaryPaths();