Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intercepting Store Kit alert views

When one of my in-app transactions is completed, either because it is restored or because it is a successful purchase, Store Kit generates an alert view that displays a confirmation dialog box. In this current version it says "Thank You. Your Purchase was successful.".

Since my app should move to a different screen after a purchase is successful, I want to intercept that dialog box and not make the transition until it is dismissed by the user. The problem is that I don't seem to have any control over that dialog box. Anyone has any ideas of how to do it?

Thanks!

like image 808
Chico Avatar asked Dec 02 '10 02:12

Chico


2 Answers

Don't try. Your payment delegate is notified when a purchase goes through--use that mechanism. Those alerts are part of the AppStore.app binary and aren't executed in your process, so you can't touch them.

like image 118
Jonathan Grynspan Avatar answered Sep 21 '22 22:09

Jonathan Grynspan


You can use the fact that the app becomes inactive when those StoreKit alerts pop up:

Check UIApplication's activeState property after the purchase is finished if it's 'inactive', then delay your movement to a different screen until the state changes to 'active' again (monitor for UIApplicationDidBecomeActive notification).

'activeState' property is not supported on firmwares older than 4.0, but you can still track app state changes manually and know its state at any time.

like image 24
aleh Avatar answered Sep 17 '22 22:09

aleh