I've almost managed Auto renewable subscription in my app, but one strange thing occures - it doesn't auto renews.
I have a button, which adds an SKPayment with my product and it gives me receit with it's SKPaymentTransaction, that is really active.
Than i save that receipt and try to send it to Apple again to check the expire date.And it returns me the date of my first purchase, not the last one, in it's
expiredate.And when the subscription period ends(in five minutes in sandbox), it just returns me 21002
But if i manually renew it again, the new receipts gives me updated expire date, i save it again, and everything goes round.
original_purchase_date is the same in both of this receites.
MAybe i just don't understand, how checking of expire date works?
If you want to save a few hours of your life, here's the key that i've spent a few hours (not literaly) to find out:
Auto renew STOPS after some period in Sandbox
Some people say that it happens after 6 times(30 minutes for a montky subscription),and then you begin to get 21006's, you have to repuchase it again then, and,even after repurchase, it wouldn't auto renew anymore-you have to create a new test user to test that part of in-app again.
I felt it myself, and guys in apple forums say they experinced the same problem.
Actually, i searched a bit more,and found out in in Apples iTunes Connect Developers Guide, but i didn't read it before,so it brought me so much headache.
In my case, autorenewal works two times, then I begin seeing the 21006. Yesterday, with the same user, it did not work at all (bought once, expired after the first expiry date has passed). Apple says you do not have to create a new test user, which is maybe true - at least in my case, using one or the other user makes no difference, it seems to be the sandbox's decision.
I have also heard rumours that (at least in production) you should actually receive a new transaction upon renewal (with state restored), but I have never seen that happen in the Sandbox and I cannot find corresponding information in the In-App Purchases Programming Guide.