DocumentContext in XCode 6


Hi all,

I absolutely love reading this book! It has been written with so much knowledge. Really well explained!
In this chapter I am trying to add an observer to a Person.

The book uses the *RMDocumentKVOContext.
In XCode 6, projects aren’t created with a prefix, which is being used in the book.

Therefore I am having troubles to get the context of the Document-class I created. How can I get the Context in XCode 6?

Thanks in advance!



Hi Thijmen,

I am working on this section of the book too. As far as I understand you are basically declaring a variable with

static void *DocumentKVOContext; in your Document.m file. Note that I did not use the prefix here. So the name can be chosen arbitrarily as with every variable, but should be somehow reasonable. In this case you are declaring a pointer of type void, which means you just like to store an address, as far as I understand. This address is later used with &DocumentKVOContext (note the “&” to get the address) in several methods to identify the correspoding object(s) that observe the Person object (in this case).

Long story short, just give it a name, but a reasonable one :wink: