Facebook iOS SDK 4.0.1 “You must upgrade this app

2019-08-19 06:29发布

问题:

I am trying to upgrade a facebook app from using the soon-to-be-deprecated 1.0 API to the current one. I have replaced the frameworks (FBSDKCoreKit, FBSDKLoginKit) with the current ones (4.0.1). Doing this upgrades the app when I log in using the web-fallback. However, when I log in through the facebook app I still get the deprecation warning. This is my (abstracted) code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSLog(@"SDK version: %@", [FBSDKSettings sdkVersion]); // Prints "SDK version: 4.0.1

    UIViewController *vc = [UIViewController new];

    FBSDKLoginButton *loginButton = [FBSDKLoginButton new];
    loginButton.frame = CGRectMake(10, 200, 300, 50);
    [vc.view addSubview:loginButton];

    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    self.window.rootViewController = vc;
    [self.window makeKeyAndVisible];

    return YES;
}

When logging in, I see the following warning message:

"You must upgrade this app to Graph API v2.x"

I am aware of these two questions:

Facebook iOS SDK: Why am I getting "You must upgrade this app to Graph API v2.x"?

iOS - Facebook - You must upgrade this app to Graph API v2.x

None of them solves my problem though.

  • The problem is not that I am using an old SDK-version. I have verified that the files on disk and in the project are the ones downloaded from the 4.0.1 SDK, which I also verify by printing the SDK-version. I have tried deleting and re-adding them several times.

  • The problem is not the code. My code does basically nothing, just calls the built in login-code for fb.

  • This is the iOS SDK, so I do not specify the urls for the API-calls myself. The official documentation states that using the most recent SDK should ensure that the correct urls are used.

So the problem is either in some project setting, but they don't seem to specify api-version, or in the facebook app itself, where I cannot find it. Any help is appreciated.

回答1:

Same story here.

Purge the entire DerivedData (/Users/.../Library/Developer/Xcode/DerivedData) folder.

It helped 4