I'm not talking about the someObject instance on your singleton, I'm talking about the singleton itself. Here is a slightly more clear example of what you wrote:
Code:
NSManagedObjectSubclass *firstSingleton = [NSManagedObjectSubclass sharedObject]
id *someObject = [someSingleton someObject];
id *anotherSomeObjectObject = [[NSManagedObjectSubclass sharedObject] someObject];
You are saying that someObject !=anotherSomeOtherObject.
However, you're assuming that the above code is exactly the same as:
Code:
NSManagedObjectSubclass *firstSingleton = [NSManagedObjectSubclass sharedObject]
id *someObject = [firstSingleton someObject];
id *someObjectAgain = [firstSingleton someObject];
Which it is not because if that were the case, the second code can
only translate into:
someObject == someObjectAgain. The problem, from my limited POV, is that
firstSingleton != firstSingletonAgain
What you wrote translates more into:
Code:
NSManagedObjectSubclass *firstSingleton = [NSManagedObjectSubclass sharedObject]
id *someObject = [firstSingleton someObject];
NSManagedObjectSubclass *firstSingletonAgain = [NSManagedObjectSubclass sharedObject]
id *someObjectAgain = [firstSingletonAgain someObject];
Meaning either:
sharedObject is giving you two different Singletons, one without filled properties and one with filled properties
or you are being given the same singleton and s
haredObject it isn't setting up your Singleton properly the first time it is called.
So back to my question: are references to the singleton (
firstSingleton and
firstSingletonAgain in the above snippet) the same or not? Using something similar to the last example I gave, you can set a breakpoint after your two calls and see what the identities of those objects are
.
Also, what is happening when you attempt to set it in the VC? Is your
someObject property just returning nil? Is one method working and the other not? Or is the second attempt at grabbing the
someObject always successful while the first fails? Depending on what happens in this spot, I may be pointing you down the incorrect path, but that's about the best I can do.