This repository was archived by the owner on Feb 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +25
-1
lines changed
packages/in_app_purchase/in_app_purchase_storekit
example/shared/RunnerTests Expand file tree Collapse file tree 4 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ ## 0.3.5+2
2+
3+ * Fix a crash when ` appStoreReceiptURL ` is nil.
4+
15## 0.3.5+1
26
37* Uses the new ` sharedDarwinSource ` flag when available.
Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ @implementation FIAPReceiptManager
2121
2222- (NSString *)retrieveReceiptWithError : (FlutterError **)flutterError {
2323 NSURL *receiptURL = [[NSBundle mainBundle ] appStoreReceiptURL ];
24+ if (!receiptURL) {
25+ return nil ;
26+ }
2427 NSError *receiptError;
2528 NSData *receipt = [self getReceiptData: receiptURL error: &receiptError];
2629 if (!receipt || receiptError) {
Original file line number Diff line number Diff line change @@ -313,6 +313,23 @@ - (void)testRetrieveReceiptDataSuccess {
313313 XCTAssert ([result isKindOfClass: [NSString class ]]);
314314}
315315
316+ - (void )testRetrieveReceiptDataNil {
317+ NSBundle *mockBundle = OCMPartialMock ([NSBundle mainBundle ]);
318+ OCMStub (mockBundle.appStoreReceiptURL ).andReturn (nil );
319+ XCTestExpectation *expectation = [self expectationWithDescription: @" nil receipt data retrieved" ];
320+ FlutterMethodCall *call = [FlutterMethodCall
321+ methodCallWithMethodName: @" -[InAppPurchasePlugin retrieveReceiptData:result:]"
322+ arguments: nil ];
323+ __block NSDictionary *result;
324+ [self .plugin handleMethodCall: call
325+ result: ^(id r) {
326+ result = r;
327+ [expectation fulfill ];
328+ }];
329+ [self waitForExpectations: @[ expectation ] timeout: 5 ];
330+ XCTAssertNil (result);
331+ }
332+
316333- (void )testRetrieveReceiptDataError {
317334 XCTestExpectation *expectation = [self expectationWithDescription: @" receipt data retrieved" ];
318335 FlutterMethodCall *call = [FlutterMethodCall
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: in_app_purchase_storekit
22description : An implementation for the iOS and macOS platforms of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework.
33repository : https://github.com/flutter/plugins/tree/main/packages/in_app_purchase/in_app_purchase_storekit
44issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5- version : 0.3.5+1
5+ version : 0.3.5+2
66
77environment :
88 sdk : " >=2.14.0 <3.0.0"
You can’t perform that action at this time.
0 commit comments