我已更新到
Xcode 10并且无法编译我的代码.我从Facebook SDK(FacebookCore)收到以下错误.
Argument type ‘SDKLoggingBehavior?’ does not conform to expected type
‘Sequence’
在线
return Set(behaviors)
我已经使用cocoapods安装了最新的FBSDK.
我将如何解决此问题,还是等待来自FB的更新SDK?
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) } } }
这是在最新版本0.3.1(截至2018年6月8日)中修复的.
老答案:
这是在最新的主机中修复的,但不是最新的标签或Cocoapod版本.
要使用此功能,请将代码直接从主分支克隆到Swift SDK repo中的项目中,或将podfile更改为指向master:
pod 'FacebookCore',:git => 'https://github.com/facebook/facebook-sdk-swift',:branch => 'master'
修复此问题的拉取请求可以在here找到.