以下のチュートリアルの様にSwiftでAWSのDynamoDBを使用しています。
https://docs.aws.amazon.com/ja_jp/aws-mobile/latest/developerguide/tutorial-ios-aws-mobile-notes-data.html
このチュートリアルにもありますが、以下の様なレコードを追加する処理で返ってくるエラーはどの様な時にエラーと判定されるかどうか調べた所、
The completion handler to call when the load request is complete. error: An error object that indicates why the request failed, or nil if the request was successful.
とありました。indicates why the request failedとある様にリクエストがなぜ失敗したかを示す、つまりリクエストが失敗した際にこのエラーが返される様ですが、例えばプロビジョニングされたキャパを超えて書き込みができなかった場合などはどうなるでしょうか?その場合もエラーを返してくれるのでしょうか?それともそれは送信後にキャパを超えているかどうか分かるとしたら、送信はできているという事だからリクエストは成功していて、エラーは返してはくれないでしょうか?例えば送信時にネット接続を切ったりしたらこのエラーが返されましたが、このエラーが返されていないからといって書き込みができているという訳ではないのでしょうか?端末側で実際に書き込みができたかどうかを判断する方法はありませんか?
Swift
1func insertNoteDDB(noteId: String, noteTitle: String, noteContent: String) -> String { 2 3 let dynamoDbObjectMapper = AWSDynamoDBObjectMapper.default() 4 5 // Create a Note object using data model you downloaded from Mobile Hub 6 let noteItem: Notes = Notes() 7 8 noteItem._userId = AWSIdentityManager.default().identityId 9 noteItem._noteId = noteId 10 noteItem._title = emptyTitle 11 noteItem._content = emptyContent 12 noteItem._creationDate = NSDate().timeIntervalSince1970 as NSNumber 13 14 //Save a new item 15 dynamoDbObjectMapper.save(noteItem, completionHandler: { 16 (error: Error?) -> Void in 17 18 if let error = error { 19 print("Amazon DynamoDB Save Error on new note: (error)") //キャパを超えて書き込みができなかった場合はここが実行されない? 20 return 21 } 22 print("New note was saved to DDB.") 23 }) 24 25 return noteItem._noteId! 26 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/08 03:40