views:

52

answers:

3

Hello, I`m doing something wrong with my app delegate, I'd appreciate if someone could have a look at this one .

My AppDelegate.h :

{

BOOL *moveState;

}

@property (nonatomic) IBOutlet BOOL *moveState ;

My AppDelegate.m:

@synthesize moveState;

and my ViewController from where I'm trying to set the moveState value :

AppDelegate *moveUp = (AppDelegate *) [[UIApplication sharedApplication] delegate];

[moveUp setMoveState:YES];

It`s returning : makes pointer from integer without a cast

+2  A: 

You used BOOL * when you probably meant to use BOOL.

blucz
A: 

You declare a pointer to BOOL (BOOL *moveState) instead of a plain BOOL (BOOL moveState). Just change your interface:

@interface Application : NSObject <UIApplicationDelegate> {
    BOOL moveState;
}
@property(nonatomic, assign) BOOL moveState;
@end

And by the way, you are probably designing the code wrong by storing the move state flag in the application delegate. Does the move state have anything to do with the application lifecycle? If not, why are you storing it in the application delegate? So that you can get it everywhere in the application through [[UIApplication sharedApplication] delegate]? That’s misusing the singleton pattern, take a good look at Miško Hevery’s article called Singletons are Pathological Liars and the articles linked from there.

zoul
cool, thanks for the explanation :)
Julz
A: 

Dont need to user pointer for BOOL only BOOL moveState will do ..

mrugen