通过lambda函数删除操作

时间:2016-09-12 21:13:13

标签: ios swift amazon-web-services aws-lambda

  let calcium = Set([
        ":calcium"
    ])
    if (editingStyle == UITableViewCellEditingStyle.Delete) {
        // handle delete (by removing the data from your AWS)
        let lambdaInvoker = AWSLambdaInvoker.defaultLambdaInvoker()
        let jsonObject: [String: AnyObject] = [
            "TableName":  "diaFitMessages",
            "operation": "update" ,
            //import email from other view controller -> public variable
            "Key": ["email": email],
            "UpdateExpression": "delete #date :responses",
            "ExpressionAttributeNames": [
                "#date": currentDate
            ],
            "ExpressionAttributeValues": [
                ":responses": calcium
            ],
            "ReturnValues": "NONE"
        ]
        let task = lambdaInvoker.invokeFunction("handlerDiaFIT", JSONObject: jsonObject)
        task.continueWithBlock { (task: AWSTask) -> AnyObject? in
            if task.error != nil {
                print(task.error)


            } else {
                print("DELETED")]

出于某种原因,由于未捕获的异常'NSInvalidArgumentException',我不断获取***终止应用程序,原因:'JSON写入中的无效类型(_TtGCs22_NativeSetStorageOwnerSS_)' 即使我的currentDate是一个正确的字符串,我的回答是一个集合。

0 个答案:

没有答案