-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safeguard against nil productIdentifiers or payments #297
Safeguard against nil productIdentifiers or payments #297
Conversation
Purchases/Public/RCPurchases.m
Outdated
@@ -953,8 +953,11 @@ - (void)handleReceiptPostWithTransaction:(SKPaymentTransaction *)transaction | |||
[self markAttributesAsSyncedIfNeeded:subscriberAttributes appUserID:self.appUserID error:error]; | |||
|
|||
RCPurchaseCompletedBlock completion = nil; | |||
NSString *productIdentifier = transaction.payment.productIdentifier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add nullable since we're going to check for nullabiilty.
we should also maybe add a log entry, in case a future dev looks at the docs and (reasonably) assumes that this should never be nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could have a method that unwraps the whole thing and RCLogs if we're using it in a couple of places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it in d735da0, I doubted about making an extension function on SKTransaction
, what do you think?
Purchases/Public/RCPurchases.m
Outdated
- (nullable NSString *)productIdentifierFrom:(SKPaymentTransaction *)transaction | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: the {
should go at the end,
- (nullable NSString *)productIdentifierFrom:(SKPaymentTransaction *)transaction {
It looks like #303 had some tests that could fail depending on the speed of the machine. |
#304 should fix the tests |
8207f32
to
a3c8694
Compare
We were assuming
transaction.payment.productIdentifier
to not be nil in some places inRCPurchases
.This will most likely fix #279