且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在本地保存SKProduct对象?

更新时间:2023-02-02 20:48:02

您的SKProduct类需要符合NSCoding协议。

Your SKProduct class needs to conform to the NSCoding protocol.

换句话说,您需要在SKProduct类中填写这两个方法。

In other words you need to fill out these two methods in your SKProduct class.


  • (void)encodeWithCoder:(NSCoder *)aCoder;

  • (id)initWithCoder:(NSCoder *)aDecoder;

这将带你的SKProduct类,并将其分解,以便它可以序列化和反序列化。

This will take your SKProduct class and break it down so that it can be serialized and unserialized.