5

How to assign empty value to an NSData not NULL value ?

I didn't want to assign null nor nil. I wanted empty value not like the code below.

NSData* variable = NULL; // not even assigning to nil
NSData* variable = nil;

2 Answers 2

20
NSData *variable = [[NSData alloc] init];
// don't forget to release if not using ARC.
Sign up to request clarification or add additional context in comments.

Comments

3
NSData *data = [[NSData alloc] init];

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.