Search code examples
objective-ccocoacocoa-touchnsinvocation

How to encode a NSInvocation?


Can I fix this with adding a category of <NSCoding> methods ?


Solution

  • 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.