Restore purchase: Ask user for logging in to itunes store

Hi guys. My app allows user buy items and when they switch to another phone, they need to be able to restore items that they purchased before. When click on Restore button I call:

store.restore()

but nothing happens. When click on an item to buy, it asks for login to itunes store. The question is, how can I archive the same action with the Restore button? How can I determine how many items will be restored and show an alert like “Your items have been restored” after all finished? My app has been rejected by missing the Restore Buttton. Please help. Thanks in advance!

Hi @truongminhthinh,

Did you follow the example in the documentation?

https://docs.coronalabs.com/api/library/store/restore.html

Best regards,

Brent

Hi @brent thanks for replying.

Sure I’ve followed the example in the docs. After click the Restore button and my code call the “store.restore()”, in the listener I try to show an alert popup but nothing happens.

In additional, as the docs  the restore transaction listener will be fired by every items is being restored so I don’t know when the restore finished by all items (don’t know how many items will be restored) so that I can show the “finish” alert to user.

If you have nothing to restore, you won’t get a call back.  You have to treat the restore operation as  background operation with the notion that you won’t know when it finishes.

Rob

Hi @truongminhthinh,

Did you follow the example in the documentation?

https://docs.coronalabs.com/api/library/store/restore.html

Best regards,

Brent

Hi @brent thanks for replying.

Sure I’ve followed the example in the docs. After click the Restore button and my code call the “store.restore()”, in the listener I try to show an alert popup but nothing happens.

In additional, as the docs  the restore transaction listener will be fired by every items is being restored so I don’t know when the restore finished by all items (don’t know how many items will be restored) so that I can show the “finish” alert to user.

If you have nothing to restore, you won’t get a call back.  You have to treat the restore operation as  background operation with the notion that you won’t know when it finishes.

Rob