iOS升级swift3 遇到Overriding non-open instance method outside of its defining module的解决方案
2017-02-09 17:20
1826 查看
最近将我之前的一个swift项目升级swift3,说多了都是泪。。。
其中,遇到这样一个错误:
这是用的三方:ENSwiftSideMenu时引出的
报了两个错:
1、Cannot inherit from non-open class 'ENSideMenuNavigationController' outside of its defining module
2、Overriding non-open instance method outside of its defining module
之前swift2.3明明都是OK的,现在变这样了,对比了下,发现是这个导致的:
swift2.3:
swift3.0
然后,我将public写成open后,重新run就ok了。。。
open:公开的,内部外部模块都可访问,这个开放性最大;public:也是公开的,但还是与open有所区别。
open与public区别:public在只能限制在定义所在模块内部进行继承与方法的重写,而open则是只要模块有被import,在可在此模块中继承或者重写被import进来的模块中的类或方法。
其中,遇到这样一个错误:
这是用的三方:ENSwiftSideMenu时引出的
报了两个错:
1、Cannot inherit from non-open class 'ENSideMenuNavigationController' outside of its defining module
2、Overriding non-open instance method outside of its defining module
之前swift2.3明明都是OK的,现在变这样了,对比了下,发现是这个导致的:
swift2.3:
swift3.0
然后,我将public写成open后,重新run就ok了。。。
open:公开的,内部外部模块都可访问,这个开放性最大;public:也是公开的,但还是与open有所区别。
open与public区别:public在只能限制在定义所在模块内部进行继承与方法的重写,而open则是只要模块有被import,在可在此模块中继承或者重写被import进来的模块中的类或方法。
相关文章推荐
- [ios]关于error:Cannot assign to 'self' outside of a method in the init family
- Swift 4.0 报错:Argument of '#selector' refers to instance method xxx
- [IOS] 错误:Cannot assign to 'self' outside of a method in the init family
- iOS 初始化报错 cannot assign to self outside of a method in the init
- window's property of status and screen,method of open、alert and close
- annotation:@Override出现The method of type must override asuperclass解决方案
- 关于“This file has been modified outside of the source editor. Do you want to reload it?”错误的处理
- 4、Factory Method工厂方法(创建型)Creates an instance of several derived classes
- ASP.NET MVC Html.TextBox 报 Object reference not set to an instance of an object 的解决方案
- 错误整理:Unable to add module to the current project as it is not of packaging type 'pom'
- myeclipse 10 JSP页面遇到的问题:Cannot return from outside a function or method
- VC6编辑时提示This file has been modified outside of the source of editor.Do you want to reload it?解决方法
- theos iOSOpenDev 遇到的问题
- 引导页使用ViewPager遇到OutofMemoryError的解决方案
- timeit – Time the execution of small bits of Python code. - Python Module of the Week
- 启动10.2.0.5的OEM时,遇到ssl: Open wallet failed, ret = 28750的错误解决方案
- 在C#中直接使用Open API的方法 / A Method of Using Open API in C#
- 当在一个siliverlight 2.0工程中 添加webservice时 遇到错误:'Object reference not set to an instance of an object' 解决办法
- 在C#中直接使用Open API的方法 / A Method of Using Open API in C#
- instance method '-AddList:' not found (return type defaults to 'id')---- iOS开发之最灵异事件之6