swift - Xcode 8 Swift 3 段错误 : 11

标签 swift swift3 xcode8

此代码生成段错误:编译时出现 11 错误:

class Test: UICollectionViewLayout {
    var sublayout: Sublayout?
    override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
        sublayout?.shouldInvalidate?(forNewBounds: newBounds, currentBounds: collectionView!.bounds)
        return true
    }
}

@objc protocol Sublayout {
    @objc optional func shouldInvalidate(forNewBounds: CGRect, currentBounds: CGRect)
}

有什么想法吗?

最佳答案

仅供引用,在将我的 Swift 2.2 iOS 应用程序转换为 Swift3/Xcode8 后,我遇到了段错误 11。在 2.2 下,该应用程序编译时没有错误或警告,因此我认为 S3/XC8 尚未准备好进行实际工作。

关于swift - Xcode 8 Swift 3 段错误 : 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39668446/

相关文章:

swift - 闭包解释中的强、弱和无主 self

ios - Swift 3.0 中 UIView 内的 UITableView

ios - 此处 map iOS SDK 中的静音语音方向

ios - XLPagerTabStrip - 选定的选项卡选择不起作用

ios - 使用 UIModalPresentationStyleCurrentContext 呈现 View Controller 时的布局问题

swift - 接受通用集合并返回索引数组的函数

swift - 从一个 ViewController 转到另一个 ViewController 并更新

ios - 自定义 View 中的图像不会实时渲染

ios - pushViewController 无法在 swift 3 中工作

swift - IOS Realm Swift 其他 Realm 从不正确的线程访问