> On Jul 31, 2015, at 2:51 PM, Jens Alfke <j...@mooseyard.com> wrote:
> 
> Your code should work if you change String(…) to NSString(…).

However, there’s no need to bother getting the bytes and length from the 
NSData, since there’s an initializer that takes just an NSData:

if let name = NSString(data: dataValue, encoding: NSUTF8StringEncoding) as? 
String {
        // do something with name
}

Charles

_______________________________________________

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