Assignment makes a pointer from a whole without a role

I have an Obj-C method like this:

-(void)getUserDefaults:(BOOL *)refreshDefaults
{
    PostAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];

    if (refreshDefaults) {
        [appDelegate retrieveDefaults];
    }
}

When I call it that, I get no warning:

[self getUserDefaults:NO];

When I call this, I get a warning:

[self getUserDefaults:YES];

warning: passing argument 1 of 'getUserDefaults:' makes a pointer from an integer without cast

NOTE. I always call the method that passes NO first, and then passes YES after a while

Can someone fill me with the fact that the problem is here? Thanks.

+3
source share
5 answers

getUserDefaults BOOL *. , , 0, 0 - NULL, BOOL *. - 1, .

getUserDefaults BOOL .

+15

BOOL - , ,

-(void)getUserDefaults:(BOOL)refreshDefaults;

. , , , 0 ( NO) , NULL, 1 ( YES ) .

+17

Obj-C, , 'refreshDefaults' BOOL, BOOL.

Obj-C, NO, 0, ( NULL.) '1'. ( , "if (refreshDefaults)" - , refreshDefaults NULL)

+5

! ! :

-(void)getUserDefaults:(BOOL)refreshDefaults
{
PostAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];

if (refreshDefaults) {
    [appDelegate retrieveDefaults];
}
}
+3

NO, -, 0 - . Bool *. 1, , Bool *, 1, Bool *.

+1

All Articles