This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[in_app_purchase] Fix app exceptions caused by missing App Store receipt #2862
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
facb369
Fix crash caused by missing on-device App Store receipt
LHLL 3a1c70b
Update changelog
LHLL 2f68d7a
Fix redefination error
LHLL ebf622e
Use the method that handles exceptions
LHLL b863b7e
Handle receipt exceptions
LHLL fd3b5c4
Fixing the build error
LHLL 75016aa
Fix typo
LHLL 781a7c1
Formatting
LHLL cef1071
Fix typo
LHLL 45c868c
Use flutter format instead of dartfmt
LHLL 4e163c9
Fix failing test targets
LHLL b2f3fab
Fix formatting
LHLL 1c143b9
Add print
LHLL c961951
Merge branch 'master' into Receipt
LHLL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,18 +16,22 @@ @implementation FIAPReceiptManager | |
|
|
||
| - (NSString *)retrieveReceiptWithError:(FlutterError **)error { | ||
| NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; | ||
| NSData *receipt = [self getReceiptData:receiptURL]; | ||
| NSError *err; | ||
| NSData *receipt = [self getReceiptData:receiptURL error:&err]; | ||
| if (err) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also add an xctest to test this?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. friendly ping @LHLL |
||
| *error = [FlutterError errorWithCode:[[NSString alloc] initWithFormat:@"%li", (long)err.code] | ||
| message:err.domain | ||
| details:err.userInfo]; | ||
| return nil; | ||
| } | ||
| if (!receipt) { | ||
| *error = [FlutterError errorWithCode:@"storekit_no_receipt" | ||
| message:@"Cannot find receipt for the current main bundle." | ||
| details:nil]; | ||
| return nil; | ||
| } | ||
| return [receipt base64EncodedStringWithOptions:kNilOptions]; | ||
| } | ||
|
|
||
| - (NSData *)getReceiptData:(NSURL *)url { | ||
| return [NSData dataWithContentsOfURL:url]; | ||
| - (NSData *)getReceiptData:(NSURL *)url error:(NSError **)error { | ||
| return [NSData dataWithContentsOfURL:url options:NSDataReadingMappedIfSafe error:error]; | ||
| } | ||
|
|
||
| @end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
new line after the version
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.
Done
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.
The diff seems odd, CHANGELOG probably needs to be re-based