sarriaroman / photoviewer

PhotoViewer Cordova Plugin
MIT License
157 stars 213 forks source link

[IOS] it occurs error when using show method with options #129

Closed writer0713 closed 6 years ago

writer0713 commented 6 years ago

related with an issue #125

@sarriaroman @almas - hi, I've used the new version library. and there's an error on ios when I pass 'options'.

(with no options, it works well)

error :

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme http.  Only the file scheme is supported.'

Any solutions?

VictorCoding commented 6 years ago

I'm getting the exact same error. I'm using version 1.1.17

erikramalho commented 6 years ago

Roll back to 1.1.16. This issue is happening on 1.1.17 version

VictorCoding commented 6 years ago

Confirmed. It works for me on 1.1.16

writer0713 commented 6 years ago

@VictorCoding @erikramalho yes, it works well on 1.1.16 (ios). but on android it occures error when sharing the picture. v1.1.17 is the fixed version for android share issue.

almas commented 6 years ago

Sorry guys for that. I`ll check it and inform you back ASAP.

writer0713 commented 6 years ago

@almas thanks man :)

almas commented 6 years ago

I just fixed and created pull request. https://github.com/sarriaroman/photoviewer/pull/131 :) 👍

sarriaroman commented 6 years ago

Closed with 1.1.8. Thanks to @almas

QiSolucoesInteligentes commented 6 years ago

Hey guys, I have the same issue with version 1.1.8. My url image is a https:// ... my code:

  showImage(extrato: HistoricoDetalhesRetorno){
    this.firebaseProvider.getDownloadURLImage(extrato.protocolo).then(url => {
      console.log(url);
      let options = {
        share: true, // default is false
        closeButton: true, // iOS only: default is true
        copyToReference: true // iOS only: default is false
      };
      this.photoViewer.show(url, 'Protocolo', options);
    });
  }

iOS stack: 2018-06-26 10:13:45.951532-0300 Vaptuber driver[53498:5382231] THREAD WARNING: ['PhotoViewer'] took '61.581055' ms. Plugin should use a background thread. 2018-06-26 10:13:47.469846-0300 Vaptuber driver[53498:5382347] Assertion failure in -[UIDocumentInteractionController setURL:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.54.4/Source/DocumentInteraction/UIDocumentInteractionController.m:183 2018-06-26 10:13:47.484739-0300 Vaptuber driver[53498:5382347] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIDocumentInteractionController: invalid scheme https. Only the file scheme is supported.' *** First throw call stack: (0x182112d8c 0x1812cc5ec 0x182112bf8 0x182b02fa0 0x18c5c38d0 0x18c5c2f14 0x18c5c2e70 0x10091e5ec 0x10091f274 0x1012e11dc 0x1012e119c 0x1012ed200 0x1012f27c8 0x1012f2500 0x181d37fac 0x181d37b08) libc++abi.dylib: terminating with uncaught exception of type NSException warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available. (lldb)


If use var option with:

      let options = {
        share: false, // default is false
        closeButton: true, // iOS only: default is true
        copyToReference: true // iOS only: default is false
      };

i got only a black screen. Any ideia how to get it work on ios ?

QiSolucoesInteligentes commented 6 years ago

Debugging plugin code i checked that problems was in: NSString* webStringURL = [image stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];

this part of the code is changing my given url and viewer got an error: My url: https://firebasestorage.googleapis.com/v0/b/vaptuber-1a545.appspot.com/o/protocol%2Fprotocolo_5519994562461_1529957279123?alt=media&token=f9ae268d-7d04-4462-9d42-71e91aac49e2 Changed url: https://firebasestorage.googleapis.com/v0/b/vaptuber-1a545.appspot.com/o/protocol%252Fprotocolo_5519994562461_1529957279123?alt=media&token=f9ae268d-7d04-4462-9d42-71e91aac49e2

Look after protocol% the difference between two urls. In my code, I remove the stringByAddingPercentEncodingWithAllowedCharacters call and work fine, but I don't know how it works on ios.

VictorCoding commented 6 years ago

I'm having the same problem. I'm getting that same error.

'UIDocumentInteractionController: invalid scheme data. Only the file scheme is supported.'

However, for me it only happens when I try to load an image via base64. And it's not all images, just one in particular.

almas commented 6 years ago

@VictorCoding This plugin does not support base64 image. You need to save it to disk and use local path to show photo.

writer0713 commented 6 years ago

@almas in my case, I use the images with local path, however, I think u need to check that this plugin has not supported base 64 image so far. on README.md file, it tells 'Base64 Support on Android' on version 1.1.14. If it used to support 'Base 64 image url', and suddenly it stops to support 'base 64 url', then it will make a big problem to those people who updates without any information.

@sarriaroman plz check this.

VictorCoding commented 6 years ago

@almas Actually my bad. The error is not happening anymore. I guess I had a bad build on my iOS. FYI though, base64 is supported on Android with the 1.1.18 version. I know we're talking about iOS here but just wanted to give feedback.