Fixing bad file permissions for Mac App Store submission when using Xcode folder references

The problem

You compile your app and test it.  It works great!  Time to submit to the Mac App Store, right?

Not yet.  Before submission, use Build and archive, Share from Xcode organizer, then install the resulting .pkg file.  (Side note:  Delete your app from everywhere first if you actually want it to install it right, otherwise it will get confused and install over existing versions, probably the one you made with build and archive!)

Uh oh.  The 60 mb file installed only 6 mb of stuff.   Huh?!

The solution

I suspect this only happens to people who are using folder references with data coming from a smb windows share.

The issue happens because the folder references in the .app get funky file permissions and while the app works fine, the pkg installer fails to copy ’em.

To fix it, right click the build target and choose Add->New Build Phase->New Run Script Build Phase and put something like the following in it:

[php]
set -ex
if [ "${CONFIGURATION}" = ‘Release’ ]; then

[ "$ACTION" = build ] || exit 0
[ "$BUILD_VARIANTS" = "normal" ] || exit 0

chmod -R o+rX,g+rX "$BUILT_PRODUCTS_DIR/Dink Smallwood HD.app/Contents/Resources"
fi
[/php]

A google search on this esoteric issue failed me so I’m posting this in the hopes of helping you, dear random googler, in your time of need.

Dink Smallwood HD coming to Mac one way or another

Oh, and yeah, I’m trying to get Dink HD on the Mac App Store.  It will be a free app.  It will probably be rejected because of the DMOD support (downloading user levels) but I have to try.

If rejected, I guess I’ll just release normally as a download from here, but that’s too bad as I really like the auto-updating/ratings features of an App Store.

2 thoughts on “Fixing bad file permissions for Mac App Store submission when using Xcode folder references

  1. Linus

    Apple is so stupid sometimes, let’s hope they aren’t today.
    Oh and you’ll post here if it gets accepted right? I don’t wanna miss it!

  2. James

    I have been trying to debug this one for half a day now, finally after being led to file permissions I came across your post! Thank you!!!

Leave a Reply

Your email address will not be published. Required fields are marked *