Swift
Swift
Transition from Http.S3_DeleteMultipleObjects to Http.S3_DeleteObjects
Provides instructions for replacing deprecated S3_DeleteMultipleObjects method calls with S3_DeleteObjects.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
let http = CkoHttp()!
var bucketName: String? = "testBucket"
let sa = CkoStringArray()!
sa.append(str: "starfish.jpg")
sa.append(str: "clam.jpg")
sa.append(str: "shark.jpg")
let st = CkoStringTable()!
st.append(value: "starfish.jpg")
st.append(value: "clam.jpg")
st.append(value: "shark.jpg")
// ------------------------------------------------------------------------
// The S3_DeleteMultipleObjects method is deprecated:
var responseObj: CkoHttpResponse? = http.s3_DeleteMultipleObjects(bucketName: bucketName, objectNames: sa)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
// ...
// ...
responseObj = nil
// ------------------------------------------------------------------------
// Do the equivalent using S3_DeleteObjects.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
let responseOut = CkoHttpResponse()!
success = http.s3_DeleteObjects(bucketName: bucketName, objectNames: st, jsonResponse: responseOut)
if success == false {
print("\(http.lastErrorText!)")
return
}
}