Reputation:
With the newest Xamarin Studio (4.0.13) I'm trying to use asset catalogs in my app. The app has two different app icon sets: one for all test (Test.plist) and staging (Staging.plist) builds, and one for all pre-production (PreProduction.plist) and Production (Production.plist) builds. The test bundle contains NO app icons, since we want QA to be clear this is NOT the same as a production build.
I've already started doing a Pre-Build plist cp
step (not ideal; Xamarin Studio should support conditionally including files based on build config). Is there a way to conditionally bundle (build action ImageAsset
) the .appiconset
and .launchimage
specific to my build configuration? I've specified the relevant XSAppIconAssets
and XSLaunchImageAssets
, but since they're all marked ImageAsset
they all get copied in anyway, and (unfortunately) copied into the root folder where Springboard can find and display them.
Is there any way around this without:
Adding yet more Pre-Build cp
ing to bundle the correct icon sets into one set which is the only one marked ImageAsset
:
cp iPhone/buildPlists/Staging-Info.plist Info.plist;
cp -r Resources/Images.xcassets/TestAppIcons.appiconset/*
Resources/Images.xcassets/AppIcons.appiconset;
cp -r Resources/Images.xcassets/TestLaunchImages.launchimage/*
Resources/Images.xcassets/LaunchImages.launchimage
Adding blank image files to the This doesn't work, the order icon sets are copied to the output folder is undefinedTestAppIcons.appiconset
catalog?
Upvotes: 8
Views: 3238
Reputation:
I've used the above cp
script which has essentially solved my problem.
More information which may help others:
You can't rely on XSAppIconAssets
and XSLaunchImageAssets
being checked AFTER you do a Pre-Build plist copy step. Xamarin Studio appears to use the values present in Info.plist
at the beginning of the build process.
Asset catalogs work the following way under the hood:
.app
in the form CatalognameModifiers.ext
(e.g. [email protected]
)
UILaunchImages
key in Info.plist
, and the OS handles the lookup of these transparentlyCatalognameDimensions.ext
, including the 57x57
(which previously were simply Icon.png
/[email protected]
), and these names are assigned to arrays under the CFBundleIcons
and CFBundleIcons~ipad
keys in Info.plist
As a result of the above renaming, you need to specify the catalog name, not the 'asset name' as mentioned here. In my case, I was puzzled over launch images suddenly not appearing in the app (my app moves from a splash screen to a loading spinner over the splash image). The solution was changing the code to request UIImage.FromBundle("LaunchImages")
, rather than "Default"
. Note that for iPhone 5 you currently need to request "LaunchImages-568h"
to get the right image.
Upvotes: 2