I am developing an iPhone app that uses the Facebook SDK to connect with Facebook. The SDK requires that my code set an app ID when calling code in the SDK (the app ID is registered with Facebook). I would like to open-source this project, but obviously I don't want my app ID to be used by others. How can I set up the project so that I can build it using my app ID, but other people could also build the project using their own?
Assuming that you're adding your AppID and Secret in your app's plist, you could modify your build scheme for the Release build and add a "Post Build Command" that could run a script to do the following:
echo -n ${TARGET_BUILD_DIR}/${INFOPLIST_PATH} | xargs -0 /usr/libexec/PlistBuddy -c "Set :<Your Facebook App ID Key> YOUR_APP_ID_HERE"
echo -n ${TARGET_BUILD_DIR}/${INFOPLIST_PATH} | xargs -0 /usr/libexec/PlistBuddy -c "Set :<Your Facebook Secret Key> YOUR_APP_SECRET_HERE"
That would change the value of those plist entries to some generic value.
Here's a reference to what I'm talking about. Feel free to adjust accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With