title: What is the best way to define string constants in an objective-c protocol?
body: <p>I have defined a protocol that all my plug-ins must implement. I would also like the plug-ins to all use certain strings, like MyPluginErrorDomain. With integers this is quite easily achieved in an enum, but I can't figure out how to do the same with strings. Normally, in classes I would define </p>
  
  <pre><code>extern NSString * const MyPluginErrorDomain;
  </code></pre>
  
  <p>in the .h file and in the .m file:</p>
  
  <pre><code>NSString * const MyPluginErrorDomain = @"MyPluginErrorDomain";
  </code></pre>
  
  <p>but that doesn't work very well in a protocol, because then each plug-in would have to provide its own implementation which defeats the purpose of having a constant.</p>
  
  <p>I then tried</p>
  
  <pre><code>#define MYPLUGIN_ERROR_DOMAIN @"MyPluginErrorDomain"
  </code></pre>
  
  <p>but the implementing classes in the plug-in can't seem to see the #define. Who knows a good solution?</p>