FBSDKLog: fbauth2 is missing from your Info.plist under LSApplicationQueriesSchemes and is required for iOS 9.0
Any idea what this is? I have added it in my plist but did not work.
You can continue to use URL schemes when you build your app for iOS 9 and you want to call URL schemes, you will now need to declare them in your apps Info.plist. There is a new key, LSApplicationQueriesSchemes, and here you will need to add the list of schemes you want to are canOpenURL on.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbauth2</string>
</array>
Just follow the Facebook explanation: Preparing Your Apps for iOS9
Apple mention it in their:Privacy and Your App Keynote 2015
Please just do not add this to your CFBundleURLSchemes... that will actually HIJACK any app's attempt at Facebook auth, causing a popup to show "X app wants to open " dialog...
You DO NOT want to be doing that.
cf:
https://developers.facebook.com/docs/applinks/ios
https://www.fireeye.com/blog/threat-research/2015/04/url_masques_on_apps.html
https://www.reddit.com/r/workflow/comments/2tlx29/get_url_scheme_of_any_app
I got this when running my Kiwi tests as our test target didn't have access to main bundle. So I had to add a condition to isRegisteredCanOpenURLScheme
in FBSDKInternalUtility.m
+ (BOOL)isRegisteredCanOpenURLScheme:(NSString *)urlScheme
{
static dispatch_once_t fetchBundleOnce;
static NSArray *schemes = nil;
dispatch_once(&fetchBundleOnce, ^{
schemes = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"LSApplicationQueriesSchemes"];
if (!schemes) { // This is a work around for our Kiwi tests as the Specs target doesn't have access to main bundle
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *path = [bundle pathForResource:@"Info" ofType:@"plist"];
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:path];
schemes = [dictionary valueForKey:@"LSApplicationQueriesSchemes"];
}
});
return [schemes containsObject:urlScheme];
}
To build your app for iOS 9 : ( For Facebook Share )
Info.plist
file , add another field LSApplicationQueriesSchemes under Information Property List and set it's datatype Array
or NSArray
.String
or NSString
.fbauth2
, fbshareextension
, fbapi
as item value .Follow this photo :
Write the below code in your info.plist under the **LSApplicationQueriesScheme**
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
<string>fb-messenger-platform-20150128</string>
<string>fb-messenger-platform-20150218</string>
<string>fb-messenger-platform-20150305</string>
You can try with below code in swift 5.0
extension Bundle {
static let externalURLSchemes: [String] = {
guard let urlTypes = main.infoDictionary?["LSApplicationQueriesSchemes"]
as? [String] else {
return []
}
return urlTypes
}()
}
You can call using Bundle
guard Bundle.externalURLSchemes.contains(URLScheme) else {
return
}