I'm using CTAssetPicker
(https://github.com/chiunam/CTAssetsPickerController) to pick images, convert them to JPEG and save them in a remote storage location. So far so good, until recently (and rarely) I've started to receive weird exceptions after picking assets:
NSInvalidArgumentException
-[NSNull CGImage]: unrecognized selector sent to instance 0x3759f3f0
This happens when calling UIImageJPEGRepresentation
with an image brought back from the asset picker.
I've tried to reproduce this by sending null values to the JPEG conversion, but it's not the case. It seems as the CGImage
of the UIImage
s I send are null, but I have no idea why it happens.
The problem is you are not receiving an image. You can reproduce your error with this code:
You need to fix your request.