在 Swift 中,当您调用一个可能抛出错误的函数时,您必须要么用 try 关键字标记函数调用,要么使用 do-catch 块处理错误。如果您看到错误消息“Call can throw, but it is not marked with 'try' and the error is not handled”,则表示您调用了一个可能抛出错误的函数,但您没有正确处理该错误。如何修复这些错误?用 try 关键字标记函数调用。例如 - do { let result = try someFunctionThatCanThrow() ... 阅读更多