# Problem with camera ios

**URL:** <https://forum.ionicframework.com/t/problem-with-camera-ios/20374>\
**Category:** ionic-v1\
**Created:** [April 6, 2015, 7:08pm UTC](https://forum.ionicframework.com/t/problem-with-camera-ios/20374 "2015-04-06T19:08:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sioesi](https://avatars.discourse-cdn.com/v4/letter/s/d07c76/32.png) [@sioesi](https://forum.ionicframework.com/u/sioesi)\
**Post date:** [April 6, 2015, 7:08pm UTC](https://forum.ionicframework.com/t/problem-with-camera-ios/20374/1 "2015-04-06T19:08:43Z")

</div>

I am having a problem with this plugin. We add, also add to my config.xml as follows:

```
<feature name="Camera">
    <param name="ios-package" value="CDVCamera" />
</feature>

```

Also in my .js file and add this:

```
.factory('Camera', ['$q', function($q) {

 return {
   getPicture: function(options) {
     var q = $q.defer();

  navigator.camera.getPicture(function(result) {
    // Do any magic you need
    q.resolve(result);
  }, function(err) {
    q.reject(err);
  }, options);

  return q.promise;
  }
 }
}])

```

My view :

```
<script id="camara.html" type="text/ng-template">
  <ion-view> 
  <ion-nav-title>
      <img src="img/icono_view.png" style="width: 40px;height: 40px;">
    </ion-nav-title>
  <ion-nav-back-button class="button-clear">
  <i class="ion-arrow-left-c"></i> Volver
  </ion-nav-back-button>
    <ion-content lazy-scroll>
      <button ng-click="getPhoto()" class="button button-block button-primary">Take Photo</button>
      <img ng-src="{{lastPhoto}}" style="max-width: 100%">
    </ion-content>
  </ion-view>
</script>

```

My controller :

```
.controller("CamaraCtrl", function($scope, Camera) {
  Camera.DestinationType = {
DATA_URL : 0, // Return image as base64-encoded string
FILE_URI : 1, // Return image file URI
NATIVE_URI : 2 // Return image native URI (e.g., assets-library:// on iOS or content:// on Android)
  };

  Camera.PictureSourceType = {
PHOTOLIBRARY : 0,
CAMERA : 1,
SAVEDPHOTOALBUM : 2
 };

 Camera.EncodingType = {
JPEG : 0, // Return JPEG encoded image
PNG : 1 // Return PNG encoded image
 };

  Camera.MediaType = {
PICTURE: 0, // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType
VIDEO: 1, // allow selection of video only, WILL ALWAYS RETURN FILE_URI
ALLMEDIA : 2 
 };

 Camera.Direction = {
BACK : 0, // Use the back-facing camera
FRONT : 1 // Use the front-facing camera
};

  $scope.getPhoto = function() {
var options = {
  quality: 50,
  destinationType: Camera.DestinationType.FILE_URI,
  allowEdit: true,
  encodingType: Camera.EncodingType.JPEG,
  popoverOptions: CameraPopoverOptions,
  saveToPhotoAlbum: true,
  correctOrientation: true
};
   Camera.getPicture(options).then(function(imageURI) {
  console.log(imageURI);
  $scope.lastPhoto = imageURI;
}, function(err) {
  console.err(err);
}, {
  quality: 75,
  targetWidth: 320,
  targetHeight: 320,
  saveToPhotoAlbum: false
 });
 };
})

```

This does not cause any problem nor error log but I can not access the camera, not even ask permission every time you try to access the camera. I find it strange because it is the same code that I occupy another application created with ionic. Any thoughts?
