开发者

Different binaries with "Archive" and "Build for Archiving" in Xcode4

开发者 https://www.devze.com 2023-04-03 14:14 出处:网络
I\'m trying to figure out how to build a release version of my Cocoa app the right way. So far I\'ve used the Build for Archiving option, and grabbed the app bundle from deep inside Xcode\'s DerivedD

I'm trying to figure out how to build a release version of my Cocoa app the right way.

So far I've used the Build for Archiving option, and grabbed the app bundle from deep inside Xcode's DerivedData folder.

Today I tried the Archive menu command, and used Share to save my app bundle. It seems cleaner and less hacky. Digging through the DerivedData folder just doesn't feel like the right thing to do.

But here's the thing. The binaries inside those two app bundles aren't the same. As far as I can see, they behave the same. But diff shows that they aren't equal, and their sizes suggest that there are more than trivial differences. For example, my release binary made with "Build for Archiving" 开发者_JS百科has a size of 29,576 bytes. The "Archive" version is only 21,536 bytes.

Archiving and Archive sound like they should basically be the same thing. Why are they different? Which one is "better"?


The difference is that the Archive command does all that Build for Archiving does, plus some extra actions to make a proper archive. If you perform Build for Archiving and Archive, then view the Log Navigator (Cmd+7), you will see a few additional lines for the Archive action at the end. Most notably it performs Strip on your binary, which removes all the debug symbols from you binary, and thus making it smaller.

0

精彩评论

暂无评论...
验证码 换一张
取 消