Reputation: 38
I want to figure out best practices for the following. Majority of the SDK's and API's I use offer me two APP ID's. One for live and one for testing. What is the best way to set this up so that I simply have to change one variable and the app knows the proper APP ID's to load. Example;
Example
// When app is live
kFACEBOOK_APP_ID = @"12345_live";
// When app is in development
kFACEBOOK_APP_ID = @"12345_dev";
APP_LIVE = TRUE;
[FBSettings setDefaultAppID:kFACEBOOK_APP_ID];
This should send @"12345_live";
Upvotes: 0
Views: 116
Reputation: 4316
You could do this with some basic programming fundamentals.
Treat the following code as pseudocode:
APP_LIVE = true;
if (APP_LIVE) {
// Application is in LIVE mode
kFACEBOOK_APP_ID = @"12345_live";
kOTHER_APP_ID = @"43124312_live";
} else {
// Application is in DEV mode
kFACEBOOK_APP_ID = @"12345_dev";
kOTHER_APP_ID = @"43124312_dev";
}
// Regardless of Application state LIVE/DEV, appropriate ID is now entered
[FBSettings setDefaultAppID:kFACEBOOK_APP_ID];
This code can be used in place of where you are currently running your [FBSettings setDefaultAppID:] function call.
Upvotes: 1