Ionic Camera


#1

My IPhone5(ios10.3) can’t take a photo from system

    if(this.nativeService.isIos()) {

      const options = {
        quality: 100,
        sourceType: sourceType,
        destinationType: this.camera.DestinationType.NATIVE_URI,
        encodingType: this.camera.EncodingType.JPEG,
        mediaType: this.camera.MediaType.PICTURE,
        saveToPhotoAlbum: false,
        correctOrientation: true
      };
      console.log("takePicture from ios")
      this.nativeService.showLoading("正在处理图片...")
      return this.camera.getPicture(options).then((imagePath) => {
      console.log("ios handle photo",imagePath)
      let options_resize = {
        uri: imagePath,
        // folderName: this.IMAGE_DIR,
        quality: 100,
        width: 120 * size,
        height: 120 * size
      } as ImageResizerOptions;

      return  this.imageResizer
        .resize(options_resize)
        .then((filePath: string) => {
          console.log("filePath after image resize ",filePath )
          var currentName = filePath.substr(filePath.lastIndexOf('/') + 1);
          var correctPath = filePath.substr(0, filePath.lastIndexOf('/') + 1);
          this.nativeService.hideLoading()
          return (currentName);
          // this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
        })
        .catch(err =>{
          console.error('takePicture.' , err);
          this.presentToast('错误.' + err);
        });
      }, (err) => {
        this.presentToast('错误.' + err);
        this.nativeService.hideLoading()
      });
    }
    else if(this.nativeService.isAndroid()){
      const options = {
        quality: 100,
        sourceType: sourceType,
        destinationType: this.camera.DestinationType.FILE_URI,
        encodingType: this.camera.EncodingType.JPEG,
        mediaType: this.camera.MediaType.PICTURE,
        saveToPhotoAlbum: false,
        correctOrientation: true
      };
      console.log("takePicture from android")
      this.nativeService.showLoading("正在处理图片...")
      return this.camera.getPicture(options).then((imagePath) => {
      return  this.filePath.resolveNativePath(imagePath)
        .then(filePath => {
          console.log("filePath after shot photo",filePath)
          let options_resize = {
            uri: filePath,
            folderName: this.IMAGE_DIR,
            quality: 100,
            width: 120 * size,
            height: 120 * size
          } as ImageResizerOptions;

          return  this.imageResizer
            .resize(options_resize)
            .then((filePath: string) => {
              console.log("filePath after image resize ",filePath )
              var currentName = filePath.substr(filePath.lastIndexOf('/') + 1);
              var correctPath = filePath.substr(0, filePath.lastIndexOf('/') + 1);
              this.nativeService.hideLoading()
              return (currentName);
              // this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
            })
            .catch(err =>{
              console.error('takePicture.' , err);
              this.presentToast('错误.' + err);
            });
        });
      }, (err) => {
        this.presentToast('错误.' + err);
        this.nativeService.hideLoading()
      });
    }

it show the error:


2017-11-10 11:39:42.651623+0800 IU Education[1177:642372] Clicked to update picture
2017-11-10 11:39:43.978555+0800 IU Education[1177:642372] takePicture from ios
2017-11-10 11:39:44.077057+0800 IU Education[1177:647145] [MC] System group container for systemgroup.com 

.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com 

.apple.configurationprofiles
2017-11-10 11:39:44.086286+0800 IU Education[1177:647145] [MC] Reading from public effective user settings.
2017-11-10 11:39:54.062510+0800 IU Education[1177:642372] ios handle photo assets-library://asset/asset.JPG?id=91DC3804-0CA1-43F0-A0B1-F9447EED0557&ext=JPG
2017-11-10 11:39:54.066197+0800 IU Education[1177:642372] IMAGE RESIZER START ----------------------------------------------------------------------------
2017-11-10 11:39:54.066322+0800 IU Education[1177:642372] Image Resizer Image URL : assets-library://asset/asset.JPG?id=91DC3804-0CA1-43F0-A0B1-F9447EED0557&ext=JPG
2017-11-10 11:39:54.092678+0800 IU Education[1177:642372] *** WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSInvalidArgumentException> *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]

For android side it’s working fine.
Someone help me