I use facebook to login into my application.
Trying to login using Facebook on iOS 10
, iPhone simulator 6s.
-canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
10814 : kLSApplicationNotFoundErr
-10814 No application in the Launch Services database matches the input criteria.
I am using facebook sdk version 4.13.1. Before XCode 8, same code was working perfectly.
Any Help ? Thanks in advance.
Error status 10814 occurs basically when cantOpenUrl
,which is used by the facebook
to call the url
using the arguments fbauth2:/ .As suggested bt this thread,printing happens inside this function so you cant do anything much with that
Apple changed the way of working with IOS 10.To fix this issue you can go to
Targets > Capabilities > Enable Keychain
Sharing
Here is a screenshot from the same thread linked above
As posted in this post the of the forums developor issues
The problem is with the FBSDLoginManager , the completion handler is never called
so in debuging, the author put the breakpoint in "FBSDKLoginManager.m" at "logInWithBehavior: (FBSDKLoginBehavior)loginBehavior" and findout that weakSelf getting nil and not be able to call "logInWithBehavior: serverConfiguration: serverConfigurationLoadError:"
- (void)logInWithBehavior:(FBSDKLoginBehavior)loginBehavior
{
__weak __typeof__(self) weakSelf = self;
[FBSDKServerConfigurationManager loadServerConfigurationWithCompletionBlock:^(FBSDKServerConfiguration *serverConfiguration, NSError *loadError) {
[weakSelf logInWithBehavior:loginBehavior serverConfiguration:serverConfiguration serverConfigurationLoadError:loadError];
}];
}
Solution 1:
Change FBSDKLoginManager variable as property rather than using as function variable. Make sure, FBSDKLoginManager variable must remain alive until the completion handler call
You can turn on the -Wimplicit-retain-self warning to get a warning if you reference self accidentally in a block.Posted in the Github issues
Solution 2:
You can add these to your plist
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
and also changing the AppDelegate as follows
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool
{
return SDKApplicationDelegate.shared.application(app, open: url, options: options)
}
as suggested by author After this you can run your swift3,SDK,ios10 on XCode8
Also check as mention by the author if the Google Analytics was adding its own controller on the top of your view controller by setting
Setting "FirebaseAppDelegateProxyEnabled" to "NO" in the -Info.plist solved the problem.
.
Full attribution goes to the forum and the authors mentioned in the forum