Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Xcode copy unchanged resources when building to a device?

Tags:

xcode

ios

bundle

I'm working with a rather large, asset-heavy project for iOS and I can't help but notice Xcode copying hundreds of resources (textures, spritesheets, sound files, etc..) that haven't changed at all since the last time I built to the device. It makes coding really, really slow when each build takes 2-4 minutes to pop up on the device.

Is there a way to get Xcode to recognize that it's doing redundant things or write a script that allows it to be more intelligent about how it transfers resources over to the device?

PS I realize that there may not be any built in 'appending' functionality for an app. I hope that isn't the case.

like image 467
Vexir Avatar asked Oct 06 '12 20:10

Vexir


2 Answers

You can try add another target to the project and name it "without resources". Exclude all heavy resources from this target. First time you need start app with all resources target, next time use "without resources" target. If you added something to the project you should use first target.

like image 95
NeverBe Avatar answered Oct 31 '22 12:10

NeverBe


iOS only supports deploying full application packages that are signed to the device. The process for deploying a debug build to the device is this.

  1. Compile altered source code and sign binary
  2. Alpha pre-multiply PNG images
  3. Create a folder with application resources and binary inside
  4. Sign the contents of the folder and create a ZIP file with the folder and signature
  5. Copy the ZIP file (.ipa) to the device

Unfortunately, I'd imagine the time is being spent in #3 and #4 which gets created each build. I haven't seen any way to speed this up. If you have many, many PNG images, you could try telling Xcode to skip Step 2.

NeverBe's approach sounds like a great idea if your application can allow you to not include many of the resources for most of the time you're developing. You could alternatively have a second set of much smaller/dummy resources that you could switch in and out.

like image 43
Alex Taylor Avatar answered Oct 31 '22 10:10

Alex Taylor