'在swift 3中'try'表达式[警告]中没有出现抛出函数的调用

Cha*_*era 3 warnings core-data try-catch ios swift3

我试图从核心数据中删除和反对,我在try catch中尝试了它,如下所示.

do {
   try self.managedContext.deleteObject(self.productList[indexPath.row])
} catch let error as NSError {
        print("something wrong with the delete : \(error.userInfo)")
}
Run Code Online (Sandbox Code Playgroud)

它说'no calls to throwing functions occur within 'try' expression'catch block is unreachable because no errors are throw in 'do' block.下面的图片给你更多的想法.

在此输入图像描述

为什么是这样.我不知道.怎么解决这个问题.希望你的帮助.

The*_*oup 5

deleteObject方法不抛出.移除Do-Catch块,警告将消失.警告似乎很自我解释.