Instantiating a UiImage from a byte array can be done in the following way:
UIImage(NSData(bytearray))
However, it could be that the byte array contains invalid data (no picture, not supported picture etc). In that case, the call crashes with an expected exception (RuntimeException: Objective-C initialization method returned nil).
Problem is that guarding this exception with try/catch does only help for some time. The RoboVM app crashes later. I suspected it is on next GC because the behaviour feels like it, but I could not trigger the crash by caling System.gc()
Reproduction steps/code
The following code will lead to a native crash after some time:
Issue details
Instantiating a UiImage from a byte array can be done in the following way:
UIImage(NSData(bytearray))
However, it could be that the byte array contains invalid data (no picture, not supported picture etc). In that case, the call crashes with an expected exception (
RuntimeException: Objective-C initialization method returned nil
).Problem is that guarding this exception with try/catch does only help for some time. The RoboVM app crashes later. I suspected it is on next GC because the behaviour feels like it, but I could not trigger the crash by caling
System.gc()
Reproduction steps/code
The following code will lead to a native crash after some time:
Please provide the version of RoboVM, XCode and JDK used
Stacktrace
Native crash