Swift - Why init(coder) is required in AFHTTPSessionManager?

天大地大妈咪最大 提交于 2019-12-06 08:58:40

initWithCoder: and encodeWithCoder: are used any time you encode and decode objects, usually for writing to / reading from disk. You're right that storyboards use this, but it's also a very common way to save data in between app launches.

AFHTTPSessionManager implements this method so that you can encode your session manager if you want. Because it's implemented there, you must override it in your subclass, and set or decode any non-optional properties before you call super.

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