“错误”类型的值没有成员'代码'[重复]

时间:2022-09-04 17:06:50

This question already has an answer here:

这个问题在这里已有答案:

I am moving a test application over to Xcode 8 Beta 5 and converted my code to Swift 3. I am left with a few errors regarding the switch to Error from NSError. I get an error in Xcode saying, 'Value of type 'Error' has no member 'code'. I can still use localizedDescription. Is code no longer a value within Error or is it just a bug within Xcode?

我正在将一个测试应用程序移动到Xcode 8 Beta 5并将我的代码转换为Swift 3.我有一些关于从NSError切换到Error的错误。我在Xcode中得到一个错误,'类型的值'错误'没有成员'代码'。我仍然可以使用localizedDescription。代码不再是Error中的值,还是仅仅是Xcode中的错误?

1 个解决方案

#1


53  

Figured the answer out on my own minutes later. Xcode decided to give me a did you mean suggestion and .code is now ._code.

稍后在我自己的会议记录中找出答案。 Xcode决定给我一个你的意思是建议,而.code现在是._code。

#1


53  

Figured the answer out on my own minutes later. Xcode decided to give me a did you mean suggestion and .code is now ._code.

稍后在我自己的会议记录中找出答案。 Xcode决定给我一个你的意思是建议,而.code现在是._code。