Reputation: 1215
Is it possible to configure an Xcode project to include a set of image assets that are only bundled when targeting the iPhone simulator. I don't want these images included in my app bundle when targeting real devices. I thought this might be possible with a customized "Copy Bundle Resources" build rule but haven't figured out a way to do it.
GOAL
The desire here is to show a simulator only preview image where we would normally show the live camera preview when running on the device.
Upvotes: 0
Views: 100
Reputation: 1026
Sounds like the best option is just to include it in the bundle — if it's one image, the penalty would be just a few hundred kB if you are using a high quality JPEG.
If you really insist that it can't be in the bundle, another way is to download the image from a server if your app detects it's running on the simulator. Since you are on the simulator you don't really care about wasting bandwidth.
OK, if you insist it has to be a compile time thing, you can add a "Run Script" step to your build and delete the image. This feels fragile and is probably not the best use of time (unless your users and developers are both on 56k modems).
The script should only run when building for simulator, so you should probably check some Xcode environment variable to determine that. SDKROOT
and CURRENT_ARCH
on that page look promising.
Upvotes: 1