是否可以使用Alamofire将图像上传到Cloudinary?

时间:2016-02-26 05:05:12

标签: swift alamofire cloudinary

如果没有一个快速的cloudinary库,我会尝试使用Alamofire上传照片。

number = number.replace(",",".");
double y = Double.parseDouble(number);
String x = String.format("%.2d",number);
x = x.replace(".",",");

运行并编译好,但是我收到以下错误。

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {

    let newphoto = info[UIImagePickerControllerOriginalImage] as? UIImage

    let parameters : [String :  AnyObject] = [
        "file" : newphoto!,
        "folder" : "production/photos",
        "upload_preset" : "not-cropped",
        "tags" : "object,daily-photo,operator_\(operatorId),child_\(childId),\(givenName)-\(familyName),production,25-Feb-2016,Feb-2016"
    ]

    Alamofire.request(.POST, "https://api.cloudinary.com/v1_1/<<ID>>/image/upload", parameters: parameters)
        .responseJSON { (response) -> Void in
            if let value = response.result.value {
                let json = JSON(value)
                print("Request \(response.request)")
                print("json is \(json)")
            }
    }

这是可修复的还是无法使用Alamofire上传到cloudinary?

0 个答案:

没有答案
相关问题