alloc is a class method, but init is an instance method. In your code, the compiler complains that it cannot find any class method called init , which is exact. To fix this, you must call init on the instance you received from alloc , for example:
myFraction = [Fraction alloc]; myFraction = [myFraction init];
but the most common pattern is to nest calls like this:
// calls -init on the object returned by +alloc myFraction = [[Fraction alloc] init];
It also helps to avoid errors that may occur when calling methods on an object that has been allocated but not yet initialized.
source share