Search code examples
objective-cfacebookfacebook-ios-sdk

Facebook iOS 3.7 FacebookAppId


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?


Solution

  • You can use the Preprocessor macros over here..

    How to use it :

    1. Go to Build settings of your project.

    2. Search "Preprocessor macros". Here define your macros like for eg FBDebugAPPID for debug moed & FBReleaseAPPID for release mode.

    3. 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..