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?

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"

@iami2

Do you get the same results with just the relevant code in a small test project? If so, please share a link to your test project. That'll help us better understand what's going on. If you're not familiar with preparing a test project, take a look at Creating a test project.

This way will be easy to see why the target is not having access to your BAAppGroupID

Thanks

Albert
  Worldwide Developer Relations.

Background Assets Mac (Designed for iPad)
 
 
Q