UIImagePNGRepresentation declare crashes the simulator

Hey guys,

I created a method called Base64encode.encode to encode my iOSImage to text so that I can save to a Database.  The problem is with this line.

Dim targetImageData As Ptr = UIImagePNGRepresentation(targetImage.Handle). This would crash the simulator, but not the actual build I port to the iOS device. Is there any workaround to by pass this problem? Is this some sort of 64-bit issue where the simulator does not support?

inside the code snippet:

[code] Dim targetImage As iOSImage = CType(someData, iOSImage)

Declare Function UIImagePNGRepresentation Lib "Foundation.Framework" (myImagePtr As Ptr) As Ptr
Dim targetImageData As Ptr = UIImagePNGRepresentation(targetImage.Handle)

Declare Function targetDataAsString Lib "Foundation.Framework" Selector "base64EncodedStringWithOptions:" (targetData As Ptr, options As UInteger) As CFStringRef
Return targetDataAsString(targetImageData, 0)[/code]

CType(someData, iOSImage)

are you sure someData is a Xojo iOSImage object?

Yes, someData is passed in as a parameter variable. I just didn’t show that part of the code. Everything runs fine until it hits that line of code in the simulator.