Error[8]: Undefined offset: 4, File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 121
File: /www/wwwroot/outofmemory.cn/tmp/plugin_ss_superseo_model_superseo.php, Line: 473, decode(

概述当我正在尝试登录时,我正面临着这个错误. remote: /tmp/build_f459d376d1bc10ac2e93e52575ac5ea9/Sources/App/main.swift:368:49: error: argument type 'String' does not conform to expected type 'CVarArg'remote: 当我正在尝试登录时,我正面临着这个错误.

remote: /tmp/build_f459d376d1bc10ac2e93e52575ac5ea9/Sources/App/main.swift:368:49: error: argument type 'String' does not conform to expected type 'CVararg'remote:                     NSLog("file NOT AVAILABLE","TESTNOTI")remote:                                                 ^~~~~~~~~~remote:                                                            as! CVararg

mycode的

if fileManager.fileExists(atPath: (drop.config["servers","default","KeyURL"]?.string ?? "default")) {            NSLog("file AVAILABLE","TESTNOTI")        } else {            NSLog("file NOT AVAILABLE","TESTNOTI")        }
解决方法 NSLog将格式字符串作为第一个参数,后面跟随
通过参数列表替换占位符
格式字符串(比较 String Format Specifiers).

在Apple平台上,您可以使用%@格式打印字符串:

let filename = "the file"NSLog("file not found: %@",filename)

但是,这在linux平台(例如Vapor)上不起作用.
在这里你必须将Swift字符串转换为C字符串才能通过
它作为NSLog的参数(并使用%s格式的C字符串):

let filename = "the file"filename.withCString {    NSLog("file not found: %s",[+++])}
总结

以上是内存溢出为你收集整理的swift – ‘String’不符合预期类型’CVarArg’全部内容,希望文章能够帮你解决swift – ‘String’不符合预期类型’CVarArg’所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

)
File: /www/wwwroot/outofmemory.cn/tmp/route_read.php, Line: 126, InsideLink()
File: /www/wwwroot/outofmemory.cn/tmp/index.inc.php, Line: 166, include(/www/wwwroot/outofmemory.cn/tmp/route_read.php)
File: /www/wwwroot/outofmemory.cn/index.php, Line: 30, include(/www/wwwroot/outofmemory.cn/tmp/index.inc.php)
swift – ‘String’不符合预期类型’CVarArg’_app_内存溢出

swift – ‘String’不符合预期类型’CVarArg’

swift – ‘String’不符合预期类型’CVarArg’,第1张

概述当我正在尝试登录时,我正面临着这个错误. remote: /tmp/build_f459d376d1bc10ac2e93e52575ac5ea9/Sources/App/main.swift:368:49: error: argument type 'String' does not conform to expected type 'CVarArg'remote: 当我正在尝试登录时,我正面临着这个错误.

remote: /tmp/build_f459d376d1bc10ac2e93e52575ac5ea9/Sources/App/main.swift:368:49: error: argument type 'String' does not conform to expected type 'CVararg'remote:                     NSLog("file NOT AVAILABLE","TESTNOTI")remote:                                                 ^~~~~~~~~~remote:                                                            as! CVararg

mycode的

if fileManager.fileExists(atPath: (drop.config["servers","default","KeyURL"]?.string ?? "default")) {            NSLog("file AVAILABLE","TESTNOTI")        } else {            NSLog("file NOT AVAILABLE","TESTNOTI")        }
解决方法 NSLog将格式字符串作为第一个参数,后面跟随
通过参数列表替换占位符
格式字符串(比较 String Format Specifiers).

在Apple平台上,您可以使用%@格式打印字符串:

let filename = "the file"NSLog("file not found: %@",filename)

但是,这在linux平台(例如Vapor)上不起作用.
在这里你必须将Swift字符串转换为C字符串才能通过
它作为NSLog的参数(并使用%s格式的C字符串):

let filename = "the file"filename.withCString {    NSLog("file not found: %s",)}
总结

以上是内存溢出为你收集整理的swift – ‘String’不符合预期类型’CVarArg’全部内容,希望文章能够帮你解决swift – ‘String’不符合预期类型’CVarArg’所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1015832.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存