Vexir
Vexir

Reputation: 615

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

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.

Upvotes: 12

Views: 2083

Answers (3)

Alex Taylor
Alex Taylor

Reputation: 1823

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.

Upvotes: 3

NeverBe
NeverBe

Reputation: 5038

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.

Upvotes: 4

Andrey
Andrey

Reputation: 2729

Sometimes, XCode really put unchanged resources to package. Usually, when you change files by Finder, not XCode.

Make Project -> Clean to make complete rebuild

Upvotes: 0

Related Questions