Objective-c – Apple’s Singleton example

cocoa-touchiphoneobjective-csingleton

Used the MyGizmoClass example in a iPhone app where I have an object that sets and maintain db info.

How do I eliminate the
'MyGizmoClass' may not respond to '+sharedManager'

Warning

The offending line of code is:
NSString *databasePath = [[MyGizmoClass sharedManager]databasePath];

Best Solution

It sounds like the +sharedManager method is not declared in the header. You've mentioned importing the header a couple of times but haven't said whether +sharedManager is part of that header. The error you're seeing indicates that either (a) the header's not being imported (and you've said that it is) or (b) the header is being imported but doesn't contain the method in question.