How to convert NSArray to NSData?

Viewed 82235

Can anyone tell me how to convert an NSArray to an NSData? I have an NSArray. I need to send it to an NSInputStream. In order to do that I need to convert the NSArray to an NSData.

Please help me, I'm stuck here.

7 Answers

Swift 5

let data = try! NSKeyedArchiver.archivedData(withRootObject: array, requiringSecureCoding: true)
Related