Consequences of a missing init?

cocoa, cocoa-touch, init, nsobject, objective-c

Solution

From the documentation of `init` in NSObject comes the official answer: "An object isn’t ready to be used until it has been initialized."

...and the practical answer: "The init method defined in the NSObject class does no initialization; it simply returns self."

:-)

Though functional, I don't think I'd trust a bare `alloc` given the number of places that warn that some form of `init` is required.

Problem

In the process of porting a really badly coded iOS project to OS X, in which I make a point of preserving the model layer in order to (later) being able to keep the two versions in sync. I do not currently have access to change the iOS code base - and don't particularly want to, either. Also, for all its faults, the model layer is tested and working. If it ain't broke don't fix it, they say. So I guess my question is, is the code below broke or not? Notice there is no call to `init` after the `alloc`, and the class being instantiated is a direct subclass of `NSObject`. ``` ... SuspectClass *obj = [SuspectClass alloc]; obj.arrayProperty = [NSArray arrayWith...]; // etc. ... ``` I guess another way to put the question is if `NSObject`'s `init` actually adds anything to an object?

Original source