我是swift使用ocSDK,代码如下:
//生成图片数据
let picFile1 = AVFile(data: (self.pic001.image?.jpegData(compressionQuality:0.5))!, name: "driverInfoPic1.jpg")
let picFile2 = AVFile(data: (self.pic002.image?.jpegData(compressionQuality:0.5))!, name: "driverInfoPic2.jpg")
let picFile3 = AVFile(data: (self.pic003.image?.jpegData(compressionQuality:0.5))!, name: "driverInfoPic3.jpg")
let picFile4 = AVFile(data: (self.pic004.image?.jpegData(compressionQuality:0.5))!, name: "driverInfoPic4.jpg")
let picFile5 = AVFile(data: (self.pic005.image?.jpegData(compressionQuality:0.5))!, name: "driverInfoPic5.jpg")
let picFile6 = AVFile(data: (self.pic006.image?.jpegData(compressionQuality:0.5))!, name: "driverInfoPic6.jpg")
if obj == nil{
obj = AVObject(className: "DriverInfoPic")
}
obj?.setObject((AVUser.current()?.objectId ?? ""), forKey: "driverId")
obj?.setObject(picFile1, forKey: "pic001")
obj?.setObject(picFile2, forKey: "pic002")
obj?.setObject(picFile3, forKey: "pic003")
obj?.setObject(picFile4, forKey: "pic004")
obj?.setObject(picFile5, forKey: "pic005")
obj?.setObject(picFile6, forKey: "pic006")
obj?.setObject(AVUser.current(), forKey: "ownerPointer")
AVUser.current()?.setObject(obj, forKey: "driverInfoPicPointer")//保存个人数据表,同时保存车主数据的指针
AVUser.current()?.setObject("wait", forKey: "driverStatus")
obj?.save()//保存数据
保存后,数据条里图片为空