Reputation: 4551
I have an iOS application and I am doing in this way: in the app delegate I call a method:
- (void)applicationWillResignActive:(UIApplication *)application
{
[self performSelector:@selector(myFunction) withObject:self afterDelay:0.0];
....
}
The problem is, when I implement the inAppPurchase in one of my controllers and when the user confirms the payment or cancels it, the: - (void)applicationWillResignActive:(UIApplication *)application
is invoked and myFunction
is called. I would like to not invoke myFunction
when the user accepts or cancels the payment, rather invoke it when the user lunches the app.
How i can do this ? Thanks
Upvotes: 2
Views: 361
Reputation: 4452
The reason why your application's applicationWillResignActive is because of the blue popup that shows on the screen. This popup does not belong to your application. So, the logic to call your applicationWillResignActive method will have to change.
Keep in mind that applicationWillResignActive is a method that is called by many simple OS interaction, including taking a look at the notificationCenter or the multitasking bar. If that method should not be called during these interactions, you might want to have a whitelist logic to call the method so you only call it when it needs to be called, and not just specific to in-app purchase.
Upvotes: 3