This is probably a very simple problem that I just don't understand due to my inexperience with objective-C, but I'm basically trying to format a saved NSInteger into the text of a tableview's cell.
I'm trying to do it like this:
I've create a reference to my main app like:
My main app creates the NSInteger property like so:
Every time I run the app it crashes and I get a warning that says:
"warning: passing argument 1 of 'setText:' makes pointer from integer without a cast."
What am I doing wrong here? Am I defining my property wrong in the mainAppDelegate? Do I need to make it a pointer? Assign it as (nonatomic, retain)?
I've successfully done this before with other objects. But I seem to be doing something wrong when trying to pull the int from my main app. Sorry if this is so simple but I'm pretty confused here.
I'm trying to do it like this:
Code:
[cell setText:(@"%d", appDelegate.myInt)];
I've create a reference to my main app like:
Code:
MainAppDelegate *appDelegate = (MainAppDelegate *)[[UIApplication sharedApplication] delegate];
My main app creates the NSInteger property like so:
Code:
@interface MainAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
NSInteger myInt;
}
@property NSInteger myInt;
@end
Every time I run the app it crashes and I get a warning that says:
"warning: passing argument 1 of 'setText:' makes pointer from integer without a cast."
What am I doing wrong here? Am I defining my property wrong in the mainAppDelegate? Do I need to make it a pointer? Assign it as (nonatomic, retain)?
I've successfully done this before with other objects. But I seem to be doing something wrong when trying to pull the int from my main app. Sorry if this is so simple but I'm pretty confused here.