关于Swift

2017-04-25  本文已影响10人  未知的远方

错误集锦
1,Call can throw, but it is not marked with 'try' and the error is not handled


1

// 原因就是没有处理错误 。我们根据错误提示,调用可以抛出,但它没有标记和错误处理通过加一个try解决。
// (PS: 就像Java中的异常错误处理,也是采用 try ...catch)

            do {
                try listenSocket.accept(onPort: UInt16(port))
            } catch let error as NSError {
                print("\(error.description)")
            }

@http://www.jianshu.com/p/b30d8f72e722

上一篇下一篇

猜你喜欢

热点阅读