I have a ImagePicker and selecting on the image I want to upload it.
For that I need to UIImage
toNSData
.
I have used UIImagePNGRepresentation
and UIImageJPEGRepresentation
. But both of the cases the app crash.
It works well for simulator but it crash in device in the second time.
First time it works perfect.
Asked
Active
Viewed 458 times
-1

Sajib Ghosh
- 410
- 1
- 6
- 17
-
Can you provide any code? – user28434'mstep Nov 17 '16 at 13:49
-
What's in the crash log? – ovejka Nov 17 '16 at 13:50
-
1Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: [How to create a Minimal, Complete, and Verifiable example.](http://stackoverflow.com/help/mcve) – NSNoob Nov 17 '16 at 14:05
1 Answers
0
First, Before using method debug the image view object and after check the length of NSData you get after the conversion.

Gourav Joshi
- 2,419
- 2
- 27
- 45