cameraRoll.getImage() throws error when selecting .tif image

Before I can detect the selection of a .tif image in the resolve or reject function, Fuse throws an error in cameraRoll.getImage().

cameraRoll.getImage()
  .then(function(image) {
    console.log( JSON.stringify( image ) );
  }, function( error ) {
    console.log( error );
  }
);

Thanks for the bug report. :slight_smile:

If you could provide us with a some more details about the problem that would be very helpful.

  • Error message
  • Affected platform(s)
  • Device model and OS version
  • Version of Fuse

Hi Karsten,

Sorry for not including the info in the first place. I wouldn’t mind if I can’t select a .tif image, but I don’t think it’s possible to specify this?

Error messages below are for selecting a .tif image on iOS 10.1.1, iPhone 6.
Fuse is latest release: 0.31.0 (build 8955)
Built with fuse build -t=ios on OSX 10.12.1.

2016-12-12 13:41:29.795493 matodor[6023:1634762] [Generic] Creating an image format with an unknown type is an error
2016-12-12 13:41:30.761513 matodor[6023:1634762] CGBitmapContextCreate: unsupported parameter combination: set CGBITMAP_CONTEXT_LOG_ERRORS environmental variable to see the details
Dec 12 13:41:30  matodor[6023] <Error>: CGBitmapContextCreate: unsupported parameter combination: set CGBITMAP_CONTEXT_LOG_ERRORS environmental variable to see the details
2016-12-12 13:41:30.762035 matodor[6023:1634762] CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Dec 12 13:41:30  matodor[6023] <Error>: CGContextConcatCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
2016-12-12 13:41:30.762826 matodor[6023:1634762] CGContextDrawImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Dec 12 13:41:30  matodor[6023] <Error>: CGContextDrawImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
2016-12-12 13:41:30.763295 matodor[6023:1634762] CGBitmapContextCreateImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Dec 12 13:41:30  matodor[6023] <Error>: CGBitmapContextCreateImage: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

Thanks :slight_smile:

I see this as more of a limitation than a bug, but I’ll create a support ticket for this anyway.

Although it depends a bit on how easy a fix would be, this probably won’t be a high-priority task, but I’ll keep you posted on any future updates.

Thanks!

As I said, I wouldn’t mind if you couldn’t use tiff images. My problem is that I cannot handle the error when a user selects one.

Oh, I’m sorry. Looks like I glossed over your post a bit too quick there.

So to be clear, it is the cameraRoll.getImage function that actually throws the exception? That’s certainly very strange. I haven’t yet looked into the details of how the module is implemented, but I would expect getImage to return a promise quickly before any image was selected at all.

Have you tried catching the exception by putting this code in a try/catch block?

Goodmorning Karsten,

yes, it is the cameraRoll.getImage function that triggers the error. Adding a try/catch block helps, indeed. Tested like so:

try {
  cameraRoll.getImage();
} catch( e ) {
  console.log( JSON.stringify( e ) );
}

and same errors as before, now in console.

Good morning.

Ok, that is definitively a bug, this should have returned a rejected promise instead. There has been another issue created for dealing with this.

In the meantime you’ll have to rely on a try/catch workaround.

:slight_smile:

Thanks! I have added the try/catch.

I have problem when trying to upload image larger than 3MB. Then app crushs and not throws exception. I tryed with this code but also the same. Any idea how to catch the exception ?

try {
cameraRoll.getImage();
} catch( e ) {
console.log( JSON.stringify( e ) );
}