开发者

How to encode a NSInvocation?

开发者 https://www.devze.com 2023-02-20 17:32 出处:网络
Can I fix this with adding a category of <NS开发者_开发问答Coding> methods ?While Joshua\'s answer is correct, there is a meta-answer.

Can I fix this with adding a category of <NS开发者_开发问答Coding> methods ?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消