I have updated to Xcode 10 and and am unable to compile my code. I get the following error from the Facebook SDK (FacebookCore).
Argument type 'SDKLoggingBehavior?' does not conform to expected type 'Sequence'
On line
return Set(behaviors)
I have installed the lastest FBSDK using cocoapods.
How would I go about resolving this or is it a case of waiting for an updated SDK from FB?
extension SDKSettings {
/**
Current logging behaviors of Facebook SDK.
The default enabled behavior is `.DeveloperErrors` only.
*/
public static var enabledLoggingBehaviors: Set<SDKLoggingBehavior> {
get {
let behaviors = FBSDKSettings.loggingBehavior().flatMap { object -> SDKLoggingBehavior? in
if let value = object as? String {
return SDKLoggingBehavior(sdkStringValue: value)
}
return nil
}
return Set(behaviors)
}
set {
let behaviors = newValue.map({ $0.sdkStringValue })
FBSDKSettings.setLoggingBehavior(Set(behaviors))
}
}
/**
Enable a particular Facebook SDK logging behavior.
- parameter behavior: The behavior to enable
*/
public static func enableLoggingBehavior(_ behavior: SDKLoggingBehavior) {
FBSDKSettings.enableLoggingBehavior(behavior.sdkStringValue)
}
/**
Disable a particular Facebook SDK logging behavior.
- parameter behavior: The behavior to disable.
*/
public static func disableLoggingBehavior(_ behavior: SDKLoggingBehavior) {
FBSDKSettings.disableLoggingBehavior(behavior.sdkStringValue)
}
}
}
This is fixed in the latest release, 0.3.1 (as of June 8th, 2018).
Old answer:
This is fixed in the latest master, but not in the latest tag or Cocoapod release.
To use this, clone the code directly from the master branch into your project from the Swift SDK repo, or change your podfile to point to master:
pod 'FacebookCore', :git => 'https://github.com/facebook/facebook-sdk-swift', :branch => 'master'
The pull request that fixed this issue can be found here.
Adding to @JAL's answer:
For me, installing pods still giving me version 0.3.0
modifying PodFile
with latest version number gives me latest sdk
pod 'FacebookCore','0.5.0'
pod 'FacebookLogin','0.5.0'
pod 'FacebookShare','0.5.0'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With