title: swift ios when do I need to use mediaTypes kUTTypeImage
body: <p>I have a image picker in my app where you can select images from camera roll or take a new picture then upload the images to my backend server.</p>
  
  <p>But looking around others code I see that some people use this: 
   <strong>imagePickerController.mediaTypes = [kUTTypeImage as String]</strong></p>
  
  <p>Why do you need to set mediaTypes to kUTTypeImage?</p>
  
  <p>I have not used that in my code bellow but everything still works fine</p>
  
  <p>I select images like this through a UIAlertController:</p>
  
  <pre><code>//Check if camera exist
          if UIImagePickerController.isSourceTypeAvailable(.Camera) {
              let cameraAction = UIAlertAction(title: "Take a photo", style: .Default) { (action) in
                  self.imagePicker.sourceType = .Camera
                  self.imagePicked = 1
                  self.presentViewController(self.imagePicker, animated: true, completion: nil)
  
              }
  
              alertController.addAction(cameraAction)
          }
  
          //Check if photo lib exist
          if UIImagePickerController.isSourceTypeAvailable(.PhotoLibrary) {
              let photosLibraryAction = UIAlertAction(title: "Pick image", style: .Default) { (action) in
                  self.imagePicker.sourceType = .PhotoLibrary
                  self.imagePicked = 1
                  self.presentViewController(self.imagePicker, animated: true, completion: nil)
  
              }
              alertController.addAction(photosLibraryAction)
          }
  </code></pre>
  
  <p>Then I get the images:</p>
  
  <pre><code> func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
  
  
              if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
                  //Change aspect when not dummy image
                  self.bigImage.contentMode = .ScaleAspectFill
                  self.bigImage.clipsToBounds = true
                  self.bigImage.image = pickedImage
  </code></pre>