Skip to content

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

@BigZaphod

Description

@BigZaphod

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions