Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after migrating project to swift 5 #905

Closed
antileks opened this issue Apr 8, 2019 · 16 comments
Closed

Error after migrating project to swift 5 #905

antileks opened this issue Apr 8, 2019 · 16 comments

Comments

@antileks
Copy link

antileks commented Apr 8, 2019

After upgrading to Swift 5, a lot of non-critical errors appeared. For example:
'withUnsafeBytes' is deprecated: use 'withUnsafeBytes <R> (_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R' instead

Code:

public var datatypeValue: Blob {
     return withUnsafeBytes {(pointer: UnsafePointer <UInt8>) -> Blob in
         return blob (bytes: pointer, length: count)
     }
}
@hermosillo8
Copy link

we also get the warning

'init(bytes:)' is deprecated: use init(_:) instead

Code:
public static func fromDatatypeValue(_ dataValue: Blob) -> Data { return Data(bytes: dataValue.bytes)}

@antileks
Copy link
Author

antileks commented Apr 9, 2019

@mag911
Copy link

mag911 commented Apr 16, 2019

Additionally, this fixes the other warning about init(_:)

public static func fromDatatypeValue(_ dataValue: Blob) -> Data 
    {
        return Data(_: dataValue.bytes)
    }

@sburlewapg
Copy link
Contributor

#902 fixed these build warnings & errors. #913 will update the project to Swift 5.

@akiratoya13
Copy link

#902 fixed these build warnings & errors. #913 will update the project to Swift 5.

Hi!! How to use this fixes? Thank you :).

@sburlewapg
Copy link
Contributor

@akiratoya13 The latest version in master is 0.11.6, which contains these fixes. If you use that version (also available in CocoaPods), then the warnings & errors should disappear. Stay tuned for version 0.12 which should also be coming soon :)

@akiratoya13
Copy link

@akiratoya13 The latest version in master is 0.11.6, which contains these fixes. If you use that version (also available in CocoaPods), then the warnings & errors should disappear. Stay tuned for version 0.12 which should also be coming soon :)

Hi @sburlewapg , I'm using that version. Apparently, it's not fixed. Still giving error.. Should I post the error here? It's similar error, but not exactly the same.

@sburlewapg
Copy link
Contributor

Yeah, can you post the error?

@akiratoya13
Copy link

image
This is the screenshot

@sburlewapg
Copy link
Contributor

Which version of Xcode are you using?

@akiratoya13
Copy link

Which version of Xcode are you using?

Version 10.1 (10B61). I can't update beyond that.

@sburlewapg
Copy link
Contributor

Gotcha, I think that's the issue. Version 0.11.6 requires Xcode 10.2 or later.

@akiratoya13
Copy link

Gotcha, I think that's the issue. Version 0.11.6 requires Xcode 10.2 or later.

I see. So, how do I resolve this issue? ><..

@sburlewapg
Copy link
Contributor

For now, I'd probably suggest forking 0.11.6 and changing the code back to the old version until you're able to update to Xcode 10.2, at which point you could just switch back to the master release.

@akiratoya13
Copy link

For now, I'd probably suggest forking 0.11.6 and changing the code back to the old version until you're able to update to Xcode 10.2, at which point you could just switch back to the master release.

Thanks @sburlewapg , will try that after trying upgrade the Xcode again... :)

@ypopovych
Copy link
Collaborator

You can use 0.11.5 with Xcode 10.1, or 0.12.0 with Xcode 10.2 (or 0.11.6 if you need Swift 4.2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants