美文网首页
Swift String 报错。

Swift String 报错。

作者: _10_01_ | 来源:发表于2018-04-02 17:06 被阅读38次

Argument type 'String' does not conform to expected type 'NSCopying'
Argument type 'String' does not conform to expected type 'NSSecureCoding'

String 是一个 Struct,而 class NSString : NSObject, NSCopying, NSMutableCopying, NSSecureCoding 集成了 NSCopying 和 NSSecureCoding;

所以报错时将 String 替换成 NSString 即可。

相关文章

网友评论

      本文标题:Swift String 报错。

      本文链接:https://www.haomeiwen.com/subject/udyxhftx.html