简体   繁体   中英

Xcode: Exclude images in build from asset catalog according to preprocessor flag

I have two apps that share almost everything except that one shows ads according to a preprocessor macro that is configured on the Build Settings tab.

Now, following the same rule, I need to exclude images from the Asset Catalog, so this way the app with ads doesn't include things that it shouldn't, but I don't know how to do it. Any guidelines?

Thanks

Since you have two targets in your project, the simplest solution is to have three or more image assets (xcassets) in your project.

One with images common to both targets, one with images specific to target A, and one with images specific to target B.

Then ensure that the two target-specific assets are only targeted to their respective project target.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM