• 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
Re: Init String with bytes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Init String with bytes


  • Subject: Re: Init String with bytes
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 31 Jul 2015 12:51:23 -0700

> On Jul 31, 2015, at 12:32 PM, Jan E. Schotsman <email@hidden> wrote:
>
> But the NSString Reference says:
> convenience init?(bytes bytes: UnsafePointer<Void>, length length: Int,  encoding encoding: UInt )

NSString ≠ String. It’s not toll-free bridging like you’re used to with CF. String and NSString are actually different classes, though there are automatic conversions between them, and some (but not all) NSString methods are shadowed in String.

Your code should work if you change String(…) to NSString(…).

—Jens
_______________________________________________

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: Charles Srstka <email@hidden>
References: 
 >Init String with bytes (From: "Jan E. Schotsman" <email@hidden>)

  • Prev by Date: Init String with bytes
  • Next by Date: Reusable Detail View Controller for UISplitViewController?
  • Previous by thread: Init String with bytes
  • Next by thread: Re: Init String with bytes
  • Index(es):
    • Date
    • Thread