类型“NSAttributedStringKey"(又名“NSString")没有成员“字体" [英] Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font'
问题描述
刚刚更新了 xcode 9 的 pod,我收到以下
<块引用>类型'NSAttributedStringKey'(又名'NSString')没有成员'font'
注意:确保项目的 swift 语言版本.以下是查看/检查 swift 语言版本的方法.
您有两种选择来解决您的查询:
如果您的项目有 Swift 4.0 版
- 您应该选择/下载与您的项目的 Swift 语言兼容的 POD(分享 POD 信息和 Swift 版本,以便我可以为您提供适合项目的 Pod 库的确切 Pod 版本).如果您的项目有低于 4.0 的 swift 版本
- 您需要将您的项目迁移到 Swift 4.0(如果您还没有迁移它).这是参考问答,如何从 swift(以下)<4.0 迁移到 4.0.
根据您在问题中添加的标签 - Swift3 是您当前的项目语言版本,而 pod 'Cosmos'、'~> 12.0' 支持 swift 4.
pod 'Cosmos', '~>12.0'
这里是支持 Swift 4.0 以下版本的先前版本列表.
https://github.com/evgenyneu/Cosmos/releases
尝试以前版本的 cosmos,例如:
pod 'Cosmos', '~>11.0.3'//或者pod 'Cosmos', '~>11.0.1'//或者pod 'Cosmos', '~>11.0.0
'
Just updated pods for xcode 9 and I'm getting the error below for Cosmos.
Type 'NSAttributedStringKey' (aka 'NSString') has no member 'font'
Note: Ensure swift language version of your project. Here is how you can see/check your swift language version.
You have two options as solution to your query:
If your project has Swift versio 4.0
- You should choose/download POD compatible to your project's swift language (Share me POD info and swift version, so I can provide you exact pod version version for your pod library suitable for project).If your project has swift version below 4.0
- You need to migrate your project into Swift 4.0 (if you've not migrated it). Here is ref question and answer, how to migrate from swift (below) <4.0 to 4.0.
According to tag added by you in your question - Swift3 is your current project language version and pod 'Cosmos', '~> 12.0' is supporting swift 4.
pod 'Cosmos', '~> 12.0'
Here is list of previous release supporting Swift version below 4.0.
https://github.com/evgenyneu/Cosmos/releases
Try previous release of cosmos like:
pod 'Cosmos', '~> 11.0.3'
// or
pod 'Cosmos', '~> 11.0.1'
// or
pod 'Cosmos', '~> 11.0.0
'
这篇关于类型“NSAttributedStringKey"(又名“NSString")没有成员“字体"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!