woheras
woheras

Reputation: 109

NSUserDefaults boolForKey strange behaviour on real phone

My application is approved and ready to sale in appstore today. I downloaded it from appstore immediately but when I open my application there is no ads in my application. I dont understand anything.

In my code if user buy inapp item I set the value of userdefault to TRUE.

So when application starts Im checking this userdefaults. If it is TRUE I dont show any ads , if not I call ads api.

this is part of inapp purchasing area :

    if ([productId isEqualToString:@"dontshowads"])
    {   
            //user bought inapp item. so I must remove advertorials.

            [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:@"aldimi_lite_reklamikaldirma_099"];
            [[NSUserDefaults standardUserDefaults] synchronize];
    }

and this is viewwillappear area :

    BOOL appin_reklamkaldirmaalindimi = [[NSUserDefaults standardUserDefaults] boolForKey:@"aldimi_lite_reklamikaldirma_099"];

    NSLog(@"appin_reklamkaldirmaalindimi :%d",appin_reklamkaldirmaalindimi);

    if (!appin_reklamkaldirmaalindimi) 
    {
       NSLog(@"showing ads");
    }
    else {
       NSLog(@"no ads. user bought inapp item");
    }

When I run my application in simulator everything is fine. (I deleted it first in simulator and re build it)

Console gives this logs:

    appin_reklamkaldirmaalindimi : 0
    showing ads

When I run my application in my real phone everything is fine also. (I deleted it first in my phone and re build it)

Console gives this logs:

    appin_reklamkaldirmaalindimi : 0
    showing ads

But when I run my application which is downloaded from appstore everything is different.

Console gives this logs:

    appin_reklamkaldirmaalindimi : 0
    no ads. user bought inapp item

I tried to download and check the situation in my friends phone . Everything is the same. So it is not about my phone.

how can it possible ? I thought one hour and I cant find any explanation to this situation ...

Upvotes: 1

Views: 342

Answers (1)

Alex Nichol
Alex Nichol

Reputation: 7510

The only explanation for such a weird phenomenon is that the code which you submitted to the App Store is in some way corrupted or different than the code which you tested by building off your computer. The only way to fix this problem would be to resubmit your application to the App Store.

The only other possibility I can think of is that your app has some VERY poor and incorrect memory-access tendencies, such that part of your executable code or stack somehow gets over-written before running your ad logic.

Upvotes: 1

Related Questions