Background Assets Mac (Designed for iPad)

Hello,

I have followed the instructions in https://developer.apple.com/documentation/backgroundassets to setup background asset to work on the iPhone. I am able to confirm successfully test the asset packs locally on the iPhone. However, when I try to run the my test code on the Mac (Designed for iPad), I get this error.

BackgroundAssets/AssetPackManager.swift:206: Fatal error: The app couldn’t be validated: The bundle’s info dictionary lacks a string value for the key “BAAppGroupID”.

Is this feature not supported on the Mac?

Thanks for the post.

The Background Assets framework is fully supported on the Mac. It is available on macOS 16.0 and later, as well as for iOS apps and Mac Catalyst and shown in the documentation you linked. https://developer.apple.com/documentation/backgroundassets

iOS 16.0+ iPadOS 16.0+ Mac Catalyst 16.0+

The error you are seeing is actually not a limitation of the Apple framework itself. The file AssetPackManager.swift and the specific BAAppGroupID key are not internal to the Background Assets framework.

What is your info.plist with key BAAppGroupID? Please look at the documentation https://developer.apple.com/documentation/bundleresources/information-property-list/baappgroupid

If you defined the App Group ID in your Xcode Build Settings (often as a User-Defined Build Setting that gets injected into the Info.plist), it might be restricted to iOS. Go to your app target's Build Settings. Search for the variable that populates BAAppGroupID (or search for BAAppGroupID directly if it is in the Info.plist Values section). Click the triangle next to the setting. Ensure that it is not set exclusively for "Any iOS" or "Any iOS Simulator". If the Mac destination ("Any macOS" or similar) is blank, Xcode will not inject the value when you run it as "Designed for iPad".

I would focused on the error message and check the Signing & Capabilities. Look at the top left of that pane. If you see separate tabs for "iOS" and "macOS", click on the "macOS" tab.

Albert
  Worldwide Developer Relations.

Hello,

BAAppGroupID was added directly into the info.plist and shows up under Custom iOS Target Properties (Info Tab). Screenshot attached. I can not find anywhere that I can add any macOS. I also noticed that in BuildSettings > Packaging. Info.plist file has a file assigned and Generate info.plist file is set to YES.

Thanks, let’s focus on your "Designed for iPad" issue and error in that target. You said you can’t add any Mac however are you using Mac Catalyst?

Xcode attempts to dynamically build the final Info.plist at compile time based on your project settings. When this happens, Xcode often ignores or strips out custom keys that you manually added to the physical Info.plist file, especially when switching the run destination to the Mac.

Even though the key shows up under "Custom iOS Target Properties" in the Xcode UI (which is expected, since "Designed for iPad" is technically still an iOS build), the dynamic generation process is dropping the BAAppGroupID key when compiling the Mac app bundle.

Since you already have a physical Info.plist file with the correct BAAppGroupID key inside it, you can tell Xcode generating the plist, you need to make sure the key is injected properly during the build process.

The issue seems a target issue as is working with the target that was designed to work.

Albert
  Worldwide Developer Relations.

Not using Mac Catalyst. Just the iOS app that will run on Apple Silicon Macs. How do I tell Xcode to "make sure the key is injected properly during the build process"

Background Assets Mac (Designed for iPad)
 
 
Q