简体   繁体   中英

How to encode a NSInvocation?

我可以通过添加<NSCoding>方法的类别来解决此问题吗?

While Joshua's answer is correct, there is a meta-answer.

You really don't want to archive an NSInvocation . An NSInvocation may contain an arbitrary target, may have been invoked and have an arbitrary return value, and might have any number of arbitrary arguments. Generic archiving is pretty much entirely out of the question.

You are far better off architecting our app such that you archive exactly the set of state you need to recreate an appropriately configured invocation upon unarchival.

Have you tried the documentation ? It says:

Note: NSInvocation conforms to the NSCoding protocol, but only supports coding by an NSPortCoder. NSInvocation does not support archiving.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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