4

I have been using this to convert a CIImage to NSData for ages:

  NSData *data = [imageRep representationUsingType: NSPNGFileType
                            properties:nil];

Now on El Capitan I have this error on the second line:

Null passed to a callee that requires a non-null argument

I can solve that by using an empty array on the properties, like this:

NSData *data = [imageRep representationUsingType: NSPNGFileType
                                      properties: @{}];

but I am suspecting that this can cause me problems in the future.

Is this the correct way to solve this problem?

1 Answer 1

6

Is this the correct way to solve this problem?

Yes.

There appear to be a few places in the API which accepted nil values rather than an empty collection even though it was not documented as valid. The non-nil annotations added by Apple to better support inter-working with Swift are just highlighting these.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks. I was just wanting to know if that was ok. THANKS.

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.