【发布时间】:2015-02-27 04:24:57
【问题描述】:
我正在使用第三方 c API 我正在尝试使用简单字符串调用其中一个函数。像这样的:
some_c_func("aString");
我收到构建错误:
Type 'UnsafeMutablePointer<char_t>' does not conform to protocol 'StringLiteralConvertible'
我看到了一些在字符串或类似转换上使用 utf8 的建议,几乎可以实现,但出现以下错误:
some_c_func("aString".cStringUsingEncoding(NSUTF8StringEncoding));
'UnsafePointer<Int8>' is not convertible to 'UnsafeMutablePointer<char_t>'
如何创建 UnsafeMutablePointer?
【问题讨论】: