简体   繁体   English

NSCoder可用性

[英]NSCoder Availability

trying to use the initwithcoder init method in my custom NSControl Class. 尝试在我的自定义NSControl类中使用initwithcoder init方法。

It works just fine and does what I need it to do. 它工作得很好,并且可以满足我的需要。 However and this leads me to asking this question on this here forum -> in the class reference of NCControl when you scroll down to initWithCoder and click on it it states SDKs macOS 10.10+ which leads me to believe that it would not work and do what I need it to do on versions prior to that... Unless Apple's documentation once again is wrong... 但是,这导致我在这里的论坛-> NCControl的类引用中问这个问题,当您向下滚动到initWithCoder并单击它时,它指出SDKs macOS 10.10+ ,这使我相信它无法正常工作并做什么我需要在以前的版本上使用它...除非苹果的文档再次出现错误...

BTW - from Apple's own reference (Online as well as offline) apparently the NSCoder Class is also suffering from this SDKs macOS 10.10+ 顺便说一句-从苹果自己的参考资料(在线和离线)来看,NSCoder类显然也遭受了此SDK macOS 10.10+的困扰

https://developer.apple.com/reference/foundation/nscoder https://developer.apple.com/reference/foundation/nscoder

The strange thing is that in the documentation describing how a NIB is loaded and which init methods it calls on various objects, it describes initWithCoder as being the designated initializer but that documentation is from before 10.10. 奇怪的是,在描述如何加载NIB以及它在各种对象上调用哪种init方法的文档中,它将initWithCoder描述为指定的初始化程序,但是该文档来自10.10之前的版本。

Thanks to anyone who can set my mind at ease ;-) 感谢任何能让我放心的人;-)

Yes it will not work before defined version. 是的,它将在定义的版本之前不起作用。 I think you are checking versions of Swift, if you select objective-c you should see version 10.0+ which i think should work fine for your need. 我认为您正在检查Swift的版本,如果选择Objective-C,则应该看到版本10.0+,我认为它可以很好地满足您的需求。 If you change the language, you can put your mind to ease :) 如果您更改语言,则可以放轻松:)
I am assuming if you would like to support things that far back you are going to use objective-c over swift. 我假设如果您想支持很久以前的事情,那么您将迅速使用Objective-C。
Check the below image for NSCoder documentation after you select objective-c on right hand side. 选择右侧的Objective-c之后,请查看下图的NSCoder文档。 NSCoder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM