在使用FBTestSession *fbSession = [FBTestSession sessionWithSharedUserWithPermissions:@[@"email"]];时,我在使用FBTestSession时遇到异常
如果你看下面的代码,你可以看到脸书决定从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,也没有其他设置器可用。
发布于 2013-05-14 02:09:42
您需要将它们添加为方案中的环境变量。
{scheme} >> Run >> Arguments (Tab) >> add the test app id and test app secret. https://stackoverflow.com/questions/15570013
复制相似问题