2013-03-22 20 views
2

我正在使用FBTestSession異常,如果你看一下下面的代碼,你可以看到Facebook的決定從NSProcessInfo加載應用程序設置: https://github.com/facebook/facebook-ios-sdk/blob/master/src/FBTestSession.m#L506如何使用<code>FBTestSession *fbSession = [FBTestSession sessionWithSharedUserWithPermissions:@[@"email"]];</code></p> <p>時設置FBPLISTAppIDKey和FBPLISTAppSecretKey與FBTestSession

NSDictionary *environment = [[NSProcessInfo processInfo] environment]; 
    NSString *appID = [environment objectForKey:FBPLISTAppIDKey]; 
    NSString *appSecret = [environment objectForKey:FBPLISTAppSecretKey]; 
    if (!appID || !appSecret || appID.length == 0 || appSecret.length == 0) { 
     [[NSException exceptionWithName:FBInvalidOperationException 
           reason: 
      @"FBTestSession: Missing App ID or Secret; ensure that you have an .xcconfig file at:\n" 
      @"\t${REPO_ROOT}/src/tests/TestAppIdAndSecret.xcconfig\n" 
      @"containing your unit-testing Facebook Application's ID and Secret in this format:\n" 
      @"\tIOS_SDK_TEST_APP_ID = // your app ID, e.g.: 1234567890\n" 
      @"\tIOS_SDK_TEST_APP_SECRET = // your app secret, e.g.: 1234567890abcdef\n" 
      @"To create a Facebook AppID, visit https://developers.facebook.com/apps" 
           userInfo:nil] 
     raise]; 
    } 

問題是,我無法弄清楚如何正確設置FBPLISTAppIDKey和FBPLISTAppSecretKey,並且沒有其他設置器可以使用。

回答

2

您需要將它們添加爲您的方案中的環境變量。

{scheme} >> Run >> Arguments (Tab) >> add the test app id and test app secret. 
+0

非常感謝。 – 2013-09-21 15:03:49