小编cri*_*mad的帖子

从super.init调用可以在'catch'块内使用'self'

此代码未在Swift 3.3上编译.它显示了消息:'self'在super.init调用可以访问的'catch'块中使用

public class MyRegex : NSRegularExpression {

    public init(pattern: String) {
        do {
            try super.init(pattern: pattern)
        } catch {
            print("error parsing pattern")
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

那可能是什么?

try-catch throws nsregularexpression swift

6
推荐指数
1
解决办法
360
查看次数

标签 统计

nsregularexpression ×1

swift ×1

throws ×1

try-catch ×1