4

到目前为止,Martin R 的回答非常有效。但是从 Swift2 开始,它现在引发了错误

无法使用类型为“(COpaquePointer)”的参数列表调用类型“sqlite3_destructor_type”的初始化程序

在那些行中:

private let SQLITE_STATIC = sqlite3_destructor_type(COpaquePointer(bitPattern: 0))      // https://stackoverflow.com/a/26884081/1271826
private let SQLITE_TRANSIENT = sqlite3_destructor_type(COpaquePointer(bitPattern: -1))
4

1 回答 1

4

取自@MartinR 提供的 github 帖子,答案是

internal let SQLITE_STATIC = unsafeBitCast(0, sqlite3_destructor_type.self)
internal let SQLITE_TRANSIENT = unsafeBitCast(-1, sqlite3_destructor_type.self)
于 2015-07-15T08:23:45.553 回答