When MonkeyStore fails to open, it gets stucked

Monkey Forums/Monkey Bug Reports/When MonkeyStore fails to open, it gets stucked

Ferdi(Posted 2015) [#1]
Monkey Version: MonkeyXPro83c
Target: iOS Game

Description

To make MonkeyStore more robust, I added automatic retry when the store fails to open. But I can not retry, because OnOpenStoreComplete never gets called when MonkeyStore fails.

How to reproduce the problem

1. Turn off network connection - wifi, data connection etc
2. Run iaptest
3. Notice OnOpenStoreComplete never gets called.

The Fix

Here is my solution, but I haven't read all the code to MonkeyStore, so I don't know whether my fix will cause other problems. Your input is greatly appreciated.

The solution is to add another function to the delegate. When it is successful, the productsRequest delegate is called. When it fails, it calls request delegate. In the request delegate, I set the flag _running to false.

Here is the code changes I made to monkeystore.ios.cpp:



Not sure if you want this fix in Monkey or not, I have my environment going, so if you want me to test let me know.


Xaron(Posted 2015) [#2]
Nice find. I guess there is a problem with Android then as well?


Ferdi(Posted 2015) [#3]
Hi Xaron, should be iOS specific. The problem is in iOS native code. But I haven't test Android iap yet. It is on my todo list.


Xaron(Posted 2015) [#4]
I ask because I had random crashes in Android, too. Thanks for working on it!


marksibly(Posted 2015) [#5]
Thanks for the fix - look sensible and works fine here. Just uploaded v85c which includes this fix.

Had a quick go on android and it seems to work OK offline. It doesn't 'fail' until you attempt to make a purchase though, at which point you get 'not connected to the internet' or something similar. The stores work very differently behind the scenes, so wont behave 100% identically.


Ferdi(Posted 2015) [#6]
Thanks Mark!

Hi Xaron, I am still on iOS, I keep finding reset problem in my game. It is finally stable now. I play it for entire day on/off and it hasn't reset. I haven't touch Android IAP yet, will let you know when I do.