Xcode 6.1 Swift issue - 'init()' is unavailable: superseded by import of -[NSObject init]

荒凉一梦 提交于 2019-12-21 07:09:14

问题


I have just upgraded my Xcode to 6.1 an am now getting a strange compilation error.

'init()' is unavailable: superseded by import of -[NSObject init]

I am subclassing SCNNode and have a optional references to other classes of the same type I am defining. i.e.

import UIKit
import SceneKit

    class BayNode: SCNNode {

        var leftBay:BayNode?
        var rightBay:BayNode?


        func addLeftBay()
        {

            leftBay = BayNode()   // 'init()' is unavailable: superseded by import of -[NSObject init]

        }


    }

Does anybody know how I can resolve this.

Many Thanks


回答1:


I have same problem, one way I found to suppress the error is to explicitly cast it:

leftBay = BayNode() as BayNode


来源:https://stackoverflow.com/questions/26571447/xcode-6-1-swift-issue-init-is-unavailable-superseded-by-import-of-nsobj

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!