robotmedia / RMStore

A lightweight iOS library for In-App Purchases
Apache License 2.0
2.42k stars 450 forks source link

Checking for an active auto-renewable subscription returns incorrect results #230

Open BigZaphod opened 5 years ago

BigZaphod commented 5 years ago

There's a very nasty logical flaw in RMAppReceipt's -containsActiveAutoRenewableSubscriptionOfProductIdentifier:forDate: method.

This method first sorts through the receipt records looking for the newest one (using the expiration date) and then only checks that single record against the given date. One major problem with this is that the real-life production App Store receipts sometimes have renewal records from the future in them. This means if you use the current date (or a date from a few hours ago, or yesterday, or whatever) as your reference date, this method will first find the newest possible record - which is sometimes one that has already been generated for the NEXT billing period. It will then check if the date comes after that record's start date - which of course it does not. It then erroneously returns NO.

I posted a long thread on twitter about my adventures tracking this down here: https://twitter.com/BigZaphod/status/1162094913552625665

hash3r commented 4 years ago

@BigZaphod hey, I am not sure I got your point. could you elaborate a bit more? how do you check it now? not t in a range of date but only expiration date?

Smart9110 commented 4 years ago

I had problems with getting the model to work. There were some out dated coding that would not configure.


From: hash3r notifications@github.com Sent: Tuesday, November 26, 2019 10:10 AM To: robotmedia/RMStore RMStore@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [robotmedia/RMStore] Checking for an active auto-renewable subscription returns incorrect results (#230)

@BigZaphodhttps://github.com/BigZaphod hey, I am not sure I got your point. could you elaborate a bit more? how do you check it now? not t in a range of date but only expiration date?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/robotmedia/RMStore/issues/230?email_source=notifications&email_token=AEE4PVAKHKUN46SXHKK6VLTQVTY3FA5CNFSM4IMBWL72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFFO66I#issuecomment-558559097, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEE4PVBG7K7NKM6NFPQRIILQVTY3FANCNFSM4IMBWL7Q.