Mac Catalyst: Mac Specific Data Assets Don't Load from Asset Catalog via NSDataAsset

My configuration:

  1. A iOS app that supports Mac Catalyst. This Mac Catalyst app is “optimized for Mac” it is not scaled to match iPad.
  2. I open the asset catalog and add a “Data Asset” which is a .txt file. This is set to “Universal.”
  3. I add “Mac” variant for this data asset and I add a .txt with different text.

I load the string at runtime like this:

  NSDataAsset *scriptData = [[NSDataAsset alloc]initWithName:@"TextDataAsset"];
  NSString *loadedText = [[NSString alloc]initWithData:scriptData.data encoding:NSUTF8StringEncoding];

When I run that on Mac Catalyst the text loadedText is an empty string, which is wrong. Running on iOS I get the expected string.

Is this the intended behavior? Am I supposed to use the "iPad" device for Mac assets (because I don't believe that is the case with images, etc.)

In any case I filed FB12005255

Mac Catalyst: Mac Specific Data Assets Don't Load from Asset Catalog via NSDataAsset
 
 
Q