I use NSData
to convert UIImage
from photolibrary to NSData
but it gives.
error fatal error: unexpectedly found nil while unwrapping an Optional value
Following is my code
if(o.count == 1)
{//o is [UIImage]
let imgdata:NSData? = UIImageJPEGRepresentation(self.o[0], 10)
print(o[0]) //it show <UIImage: 0x14e123cb0>, {30, 40}
print(imgdata)
}