Ios 获取错误:键入';字符串';没有成员';foregroundColor';斯威夫特4

Ios 获取错误:键入';字符串';没有成员';foregroundColor';斯威夫特4,ios,swift,Ios,Swift,我不熟悉斯威夫特。我在Swift 4中创建了一个应用程序,但是当我将Swift_版本更改为Swift 3.0时,我的代码中出现了一个错误 类型“String”没有成员“foregroundColor” 如何将其转换为当前的Swift语法 代码: 属性化字符串属性不是Swift 4之前的枚举。在这种情况下,您应该使用NSForegroundColorAttributeName NSAttributedString(string: p, attributes: [NSForegroundColorA

我不熟悉斯威夫特。我在Swift 4中创建了一个应用程序,但是当我将Swift_版本更改为Swift 3.0时,我的代码中出现了一个错误

类型“String”没有成员“foregroundColor”

如何将其转换为当前的Swift语法

代码:


属性化字符串属性不是Swift 4之前的枚举。在这种情况下,您应该使用
NSForegroundColorAttributeName

NSAttributedString(string: p, attributes: [NSForegroundColorAttributeName: #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)])

非常感谢。此外,毫无疑问:您现在可以将Swift 4应用程序上传到itunes connect吗?或者它很早?你不能用测试版的Xcode上传到应用商店
NSAttributedString(string: p, attributes: [NSForegroundColorAttributeName: #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)])