Reputation: 14317
I just installed from pkg the SDK 3.7 for Facebook.
I see that I need to put there a value for FacebookAppId
. However I have 2 apps: one for testing and one for production.
Since I need to support variables for Debug and Release, I am using an Environment file which determines the value based on the configuration value. (Debug or Release)
How can I "tell" the SDK to use the relevant one for each release type, without changing it manually when building it?
I didn't check in the source code. Just the compiled one.
Is there a way to do it?
Upvotes: 2
Views: 555
Reputation: 1028
Here's a simpler approach,
Recent Xcode project templates already have a DEBUG=1 macro defined for the Debug build configuration.
You can use it in combination with #ifdef
#ifdef DEBUG
#define FACEBOOK_APP_ID @"FB_DEVELOPMENT_ID"
#else
#define FACEBOOK_APP_ID @"FB_PRODUCTION_ID"
#endif
Upvotes: 0
Reputation: 6394
You can use the Preprocessor macros over here..
How to use it :
Go to Build settings of your project.
Search "Preprocessor macros". Here define your macros like for eg FBDebugAPPID for debug moed & FBReleaseAPPID for release mode.
FBSettings class used to override the default facebook AppId.
Then after add below code in your delegate method..
#if defined(FBDebugAPPID)
**Use your debug app id**
[FBSettings setDefaultAppID:@"DEBUGAPPId"]
#elif defined(FBReleaseAPPID)
**Use your release app id**
[FBSettings setDefaultAppID:@"RELEASEAPPId"]
#endif
Hope it resolve your problem..
Upvotes: 1
Reputation: 18073
You can change you enviornment.plist variables by adding a run script build phase
To add a Run Script Build Phase in Xcode
#!/bin/bash
if [ "${CONFIGURATION}" = "Release" ]; then
/usr/libexec/PlistBuddy -c "Set :FacebookAppID 321" "$INFOPLIST_FILE"
else
/usr/libexec/PlistBuddy -c "Set :FacebookAppID 321" "$INFOPLIST_FILE"
fi
Upvotes: 0