Sqlite.swift: 'UnsafeRawBufferPointer' is not convertible to 'UnsafePointer<_>'

Created on 27 Apr 2019  路  3Comments  路  Source: stephencelis/SQLite.swift

I used this integration to report this error.

use xcode 10.1 ,swift 4.2

I tried pod version 0.11.6 and the issue still exists. I do not want to update my Xcode yet due to other SDKs that I am using my project.

Most helpful comment

Having the same issue, it seems that 0.11.6+ should be marked as "Swift 5 Required" and not "Swift 5 Supported"

It seems like possibly replacing the implementation of datatypeValue in Foundation.swift with the following could be a possible solution to continue supporting both versions but I am unclear how safe this change actually is.

public var datatypeValue: Blob { #if swift(>=5.0) return withUnsafeBytes { (pointer: UnsafeRawBufferPointer) -> Blob in return Blob(bytes: pointer.baseAddress!, length: count) } #else return withUnsafeBytes { (pointer: UnsafePointer<UInt8>) -> Blob in return Blob(bytes: pointer, length: count) } #endif }

If you make this change and also change SWIFT_VERSION to 4.2, all the tests seem to pass on Xcode 10.1 at least

All 3 comments

hello @Viswanth92, I had to downgrade my Xcode as well, and I faced the same problem, what I did was install Sqlite manually (download version 0.11.5 and copy xcproject to your project) as said in the README and it works for me, hope it helps.

If you have any questions about it you can @'me hehe

Having the same issue, it seems that 0.11.6+ should be marked as "Swift 5 Required" and not "Swift 5 Supported"

It seems like possibly replacing the implementation of datatypeValue in Foundation.swift with the following could be a possible solution to continue supporting both versions but I am unclear how safe this change actually is.

public var datatypeValue: Blob { #if swift(>=5.0) return withUnsafeBytes { (pointer: UnsafeRawBufferPointer) -> Blob in return Blob(bytes: pointer.baseAddress!, length: count) } #else return withUnsafeBytes { (pointer: UnsafePointer<UInt8>) -> Blob in return Blob(bytes: pointer, length: count) } #endif }

If you make this change and also change SWIFT_VERSION to 4.2, all the tests seem to pass on Xcode 10.1 at least

try this
add these code into your podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '4.2'
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
    end
  end
end

and set

pod 'SQLite.swift', '0.11.5'
Was this page helpful?
0 / 5 - 0 ratings