Skip to content

Instantly share code, notes, and snippets.

@0xced
Last active March 15, 2016 15:11
Show Gist options
  • Save 0xced/ac650aae583dc6a24312 to your computer and use it in GitHub Desktop.
Save 0xced/ac650aae583dc6a24312 to your computer and use it in GitHub Desktop.
Copy and codesign libReveal.dylib in Debug configuration (for use in a run script build phase)
#!/bin/bash -e
if [ "${CONFIGURATION}" != "Debug" ]; then
exit 0
fi
REVEAL_APP_PATH=$(mdfind -onlyin / "kMDItemCFBundleIdentifier == com.ittybittyapps.Reveal" | head -n 1)
if [ ! -d "${REVEAL_APP_PATH}" ]; then
echo "warning: Reveal.app not found."
exit 0
fi
LIBREVEAL_SRC_PATH="${REVEAL_APP_PATH}/Contents/SharedSupport/iOS-Libraries/libReveal.dylib"
if [ ! -f "${LIBREVEAL_SRC_PATH}" ]; then
echo "warning: Reveal dynamic library not found. (${LIBREVEAL_SRC_PATH})"
exit 0
fi
LIBREVEAL_DST_PATH="${CODESIGNING_FOLDER_PATH}/libReveal.dylib"
cp -v -p "${LIBREVEAL_SRC_PATH}" "${LIBREVEAL_DST_PATH}"
if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
codesign -fs "${EXPANDED_CODE_SIGN_IDENTITY_NAME}" "${LIBREVEAL_DST_PATH}"
fi
@0xced
Copy link
Author

0xced commented Nov 20, 2014

Improvements over Reveal’s suggested Dynamic Library Integration:

  • You don’t have to add libReveal.dylib to your project, so it means your coworkers don’t necessarily have to install Reveal.
  • It copies libReveal.dylib when you are debugging your app only, so there is no risk to publish your app on the App Store with the library embedded.
  • It doesn’t hardcode Reveal.app path.
  • It uses EXPANDED_CODE_SIGN_IDENTITY_NAME instead of CODE_SIGN_IDENTITY which is required if you have multiple code signing identities.

I also recommend Integrating Reveal without modifying your Xcode project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment