How can I decode an object when original class is not available?

后端 未结 5 893
面向向阳花
面向向阳花 2021-02-05 00:52

I have an iOS 7 application that saves a custom object to app\'s iCloud Docs folder as a file. For this, I make use of NSCoding protocol.

@interface Person : NSO         


        
5条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-05 01:12

    If the name of the class in Objective-C is important, you need to explicitly specify the name. Otherwise, Swift will provide some mangled name.

    @objc(Person)
    class PersonOldVersion: NSObject, NSCoding {
        var name = ""
        var lastName = ""
    }
    

提交回复
热议问题