我在使用 FBTestSession 时遇到异常FBTestSession *fbSession = [FBTestSession sessionWithSharedUserWithPermissions:@[@"email"]];
如果您查看下面的代码,您可以看到 Facebook 决定从 NSProcessInfo 加载应用程序设置: https ://github.com/facebook/facebook-ios-sdk/blob/master/src/FBTestSession.m#L506
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 并且没有其他设置器可以使用。