Search code examples
iosswiftfacebookswift2facebook-sdk-4.x

Error: FBSDKApplicationDelegate.m No visible @interface for 'UIApplication' declares the selector 'openURL:options:completionHandler:'


I'm implementing Facebook SDK for a legacy iOS app written in Swift 2.2 using Xcode 7.3.1. I installed Swift version of the SDK using CocoaPods according to this tutorial.

When I try to build the project i receive this error:

FBSDKApplicationDelegate.m No visible @interface for 'UIApplication' declares the selector 'openURL:options:completionHandler:'

Here is the affected code in FBSDCoreKit:

NSOperatingSystemVersion iOS10Version = { .majorVersion = 10, .minorVersion = 0, .patchVersion = 0 };
if ([FBSDKInternalUtility isOSRunTimeVersionAtLeast:iOS10Version]) {
  [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:handler];
} 

How to solve this error without modifying Facebook SDK itself?


Solution

  • This issue is caused by using Swift 2.2/Xcode 7.3.1 with the latest (v0.2.0 as I'm posting this anwser) Facebook SDK. After migrating to latest Swift/Xcode 8.2.1 the problem is not occurring.