I wrote this function in my RootViewController . appRecord is an object that contains the XML attribute.
- (NSString*) getString:(int)row{ AppRecord *appRecord = [self.entries objectAtIndex:row]; NSString *appName = appRecord.appName; return appName; }
I want to use this function again by writing this:
RootViewController *record = [RootViewController new]; NSString *appsName = [record getString:0]; NSLOG(appsName);
After compilation, it did not return anything, but it works and returns appsName if I use this function inside the RootViewController class [self getString:0] ), so I know that there is no problem with the function. When I tried to change return appName to return @"test" , it worked and returned something when I accessed it from another class.
This means that there is a problem with this appRecord ; it was returned inside the class, but returns nothing when I access it from another class.
How to solve this problem?
source share