• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Init String with bytes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Init String with bytes


  • Subject: Init String with bytes
  • From: "Jan E. Schotsman" <email@hidden>
  • Date: Fri, 31 Jul 2015 21:32:42 +0200

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 (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Init String with bytes
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: FSFileManager strange behaviour on OS X
  • Next by Date: Re: Init String with bytes
  • Previous by thread: Re: FSFileManager strange behaviour on OS X
  • Next by thread: Re: Init String with bytes
  • Index(es):
    • Date
    • Thread