title: Singleton in iOS Objective C doesn't prevent more than one instance
body: <p>I know there are several threads on this, but none answer my questions.</p>
  
  <p>I've implemented my singleton class like this (being aware of the controversy about singletons):</p>
  
  <pre><code>+ (MyClass*) sharedInstance {
      static MyClass *_sharedInstance = nil;
      static dispatch_once_t oncePredicate;
      dispatch_once(&amp;oncePredicate, ^{
          _sharedInstance = [[MyClass alloc] init];
      });
      return _sharedInstance;
  }
  
  - (instancetype)init{
      self = [super init];
      if (self) {
          //setup code
      }
      return self;
  }
  </code></pre>
  
  <p>I tried instantiating a different object and compared it to the one returned by sharedInstance with '==' and they were indeed different.</p>
  
  <p>Questions:</p>
  
  <ol>
  <li>Shouldn't creating more than one object of the singleton class be impossible? Isn't that the point? Singleton implementation in Java prevents it.</li>
  <li>And if so, how? Should I make a setup method and call it instead of having the init implemented and doing it? </li>
  <li>Is this correct implementation?</li>
  </ol>