Hello,

This has me puzzled: I am trying to initialize a Swift string with an NSData but the analyzer denies my approach.

let dataValue:NSData = …

let name = String( bytes:dataValue.bytes, length:dataValue.length, encoding:NSUTF8StringEncoding )

Analyzer complains: "Cannot find an initializer for type 'String' that accepts an argument list of type '(bytes: UnsafePointer<Void>, length: Int, encoding: UInt)'"

But the NSString Reference says:

convenience init?(bytes bytes: UnsafePointer<Void>, length length: Int, encoding encoding: UInt )

Anyone?

Jan E.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to