gpt4 book ai didi

ios - 带有 Swift 4/Xcode 10 : Argument type 'SDKLoggingBehavior?' does not conform to expected type 'Sequence' 的 Facebook SDK

转载 作者:搜寻专家 更新时间:2023-11-01 06:56:26 24 4
gpt4 key购买 nike

我正在重新访问一个旧项目(使用 Swift 3 构建,现在使用 Swift 4),Facebook SDK 似乎存在一些问题。

我用谷歌搜索了最初的问题并找到了解决方案 here建议添加到我的 pod 文件中:

post_install do |installer|
installer.pods_project.targets.each do |target|
if ['FacebookCore', 'FacebookLogin'].include? target.name
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.2'
end
end
end
end

Here is the complete podfile .

pod install 并运行项目后,它似乎清除了我之前的错误,但是我仍然在 Pods>Pods>FacebookCore>SDKSettings.swift>enabledLoggingBehaviors 第 151 行 return Set(behaviors)

错误是(pic):

参数类型“SDKLoggingBehavior?”不符合预期类型“序列”

我不确定如何处理此错误,有谁知道如何解决此问题以使 Facebook SDK 再次运行?

在此先感谢您的帮助!

最佳答案

在 SDKSetting.swift 中

将您的 enabledLoggingBehaviors 函数替换为

public static var enabledLoggingBehaviors: Set<SDKLoggingBehavior> {
get {
let behaviors = FBSDKSettings.loggingBehavior().compactMap { 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))
}
}

希望对您有所帮助。

关于ios - 带有 Swift 4/Xcode 10 : Argument type 'SDKLoggingBehavior?' does not conform to expected type 'Sequence' 的 Facebook SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53144404/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com