LawTze-Kun LawTze-Kun - 1 year ago 92
Objective-C Question

Objective-C equivalent of UnsafePointer<CChar>

I try to write on Objective-C the Swift codes written on this tutorial.

I almost written all of it to Objective-C except for this part:

let tokenChars = UnsafePointer<CChar>(deviceToken.bytes)

My question is how can I write that part from Swift to Objective-C?

Answer Source

Remember that Objective-C is a superset of C so you can look here to find out the answer:

Interacting with C APIs: Pointers

C Syntax     | Swift Syntax
const Type * | UnsafePointer<Type>
Type *       | UnsafeMutablePointer<Type>

So a Swift UnsafePointer<CChar> is a Objective-C const CChar *

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download