I am trying to upload an image captured on camera to my server using Alamofire.
I have done this, but for some reason the its not going inside the if
block,
func imagePickerController(picker: UIImagePickerController,
didFinishPickingMediaWithInfo info: [String: AnyObject]){
print("Picker returned successfully")
if let imageURL = info[UIImagePickerControllerMediaURL]{
print(imageURL)
Alamofire.upload(.POST, "http://example.com/v2/helper/uploadImageFile", file: imageURL as! NSURL).responseJSON { response in
debugPrint(response)
}
}
}
I also tried with info[UIImagePickerControllerReferenceURL]
, nothing is working, what's wrong with my code?