小编Eri*_*les的帖子

Swift 3:'Int'类型的表达式模式不能匹配'UnsafeMutableRawPointer'类型的值

我正在将应用程序迁移到Swift 3,但是Xcode在这个函数中抛出一个错误:

错误是在案例条件("contentSize",MyObservationContext)我这样做是为了更新uiwebview的内容大小

var MyObservationContext = 0
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
    guard let keyPath = keyPath else {
        super.observeValue(forKeyPath: nil, of: object, change: change, context: context)
        return
    }
    switch (keyPath, context) {
    case("contentSize", MyObservationContext):
        webviewHeightConstraint.constant = TextoHtml.scrollView.contentSize.height
    default:
        super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
    }
}
Run Code Online (Sandbox Code Playgroud)

我愿意接受建议,谢谢.

uiwebview ios swift swift3

3
推荐指数
1
解决办法
2896
查看次数

标签 统计

ios ×1

swift ×1

swift3 ×1

uiwebview ×1