美文网首页
Swift Call can throw, but it is

Swift Call can throw, but it is

作者: KingWorld | 来源:发表于2021-08-27 10:13 被阅读0次

出现这种错误的原因就是没有处理错误

解决方法,在报错的方法外加上try catch,即 do{ try ..} catch {}
如下

do {
            try print("")
        } catch {
            print("")
            return NSAttributedString()
        }

相关文章

网友评论

      本文标题:Swift Call can throw, but it is

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