Faiz Fareed Faiz Fareed - 3 months ago 16
Objective-C Question

property access result unused - getters should not be used for side effects.

I am trying to set name of

UINavigationController
via
viewdidload
section and I am using following command
self.title = @"Categories";
it works perfectly, But I needs to name it via an array's object which is obtained via segue from previous
ViewController
hence first I used following code to put obtained value in another array

-(void) getYouga:(id)yougaObject{

currentYouga = yougaObject;

}


then I tried to use this
currentYouga
Array to obtain its
yougaName
value in my desired UINavigationController's title in viewdidload section, so I used to put following line of code in ViewDidLoad section

self.title =@"%@", currentYouga.yougaName;


and it giving me issue "property access result unused - getters should not be used for side effects"
could anyone suggest me some better solution?

Answer

TRY THIS

self.title =[NSString stringWithFormat:@"%@", [currentYouga yougaName]];
Comments