I was trying to create a property which is readonly. I wanted to initialize with a value from the class creating an instance of this class, e.g.

@property (retain,readonly) NSString *firstName;

And I tried to initialize it like this:

-(id)initWithName:(NSString *)n{ self.firstName = n; }

Once I did this, the compiler reported an error that the readonly property cannot be assigned. So how can i do this ?

Edit
Report