File tree 5 files changed +23
-6
lines changed
packages/in_app_purchase/in_app_purchase_ios
5 files changed +23
-6
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.1.2+2
2
+
3
+ * Fix crash when retrieveReceiptWithError gives an error.
4
+
1
5
## 0.1.2+1
2
6
3
7
* Fix wrong data type when cancelling user credentials dialog.
Original file line number Diff line number Diff line change @@ -251,6 +251,10 @@ - (void)testRetrieveReceiptDataError {
251
251
[self waitForExpectations: @[ expectation ] timeout: 5 ];
252
252
XCTAssertNotNil (result);
253
253
XCTAssert ([result isKindOfClass: [FlutterError class ]]);
254
+ NSDictionary * details = ((FlutterError*)result).details ;
255
+ XCTAssertNotNil (details[@" error" ]);
256
+ NSNumber * errorCode = (NSNumber *)details[@" error" ][@" code" ];
257
+ XCTAssertEqual (errorCode, [NSNumber numberWithInteger: 99 ]);
254
258
}
255
259
256
260
- (void )testRefreshReceiptRequest {
Original file line number Diff line number Diff line change @@ -261,7 +261,15 @@ @implementation FIAPReceiptManagerStub : FIAPReceiptManager
261
261
262
262
- (NSData *)getReceiptData : (NSURL *)url error : (NSError **)error {
263
263
if (self.returnError ) {
264
- *error = [[NSError alloc ] init ];
264
+ *error = [NSError errorWithDomain: @" test"
265
+ code: 1
266
+ userInfo: @{
267
+ @" name" : @" test" ,
268
+ @" houseNr" : @5 ,
269
+ @" error" : [[NSError alloc ] initWithDomain: @" internalTestDomain"
270
+ code: 99
271
+ userInfo: nil ]
272
+ }];
265
273
return nil ;
266
274
}
267
275
NSString *originalString = [NSString stringWithFormat: @" test" ];
Original file line number Diff line number Diff line change 4
4
5
5
#import " FIAPReceiptManager.h"
6
6
#import < Flutter/Flutter.h>
7
+ #import " FIAObjectTranslator.h"
7
8
8
9
@interface FIAPReceiptManager ()
9
10
// Gets the receipt file data from the location of the url. Can be nil if
@@ -20,10 +21,10 @@ - (NSString *)retrieveReceiptWithError:(FlutterError **)flutterError {
20
21
NSData *receipt = [self getReceiptData: receiptURL error: &receiptError];
21
22
if (!receipt || receiptError) {
22
23
if (flutterError) {
23
- *flutterError = [FlutterError
24
- errorWithCode: [[ NSString alloc ] initWithFormat: @" %li " , ( long )receiptError. code]
25
- message: receiptError. domain
26
- details: receiptError. userInfo];
24
+ NSDictionary *errorMap = [FIAObjectTranslator getMapFromNSError: receiptError];
25
+ *flutterError = [FlutterError errorWithCode: errorMap[ @" code" ]
26
+ message: errorMap[ @" domain" ]
27
+ details: errorMap[ @" userInfo" ] ];
27
28
}
28
29
return nil ;
29
30
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: in_app_purchase_ios
2
2
description : An implementation for the iOS platform of the Flutter `in_app_purchase` plugin. This uses the iOS StoreKit Framework.
3
3
repository : https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/in_app_purchase_ios
4
4
issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5
- version : 0.1.2+1
5
+ version : 0.1.2+2
6
6
7
7
environment :
8
8
sdk : " >=2.12.0 <3.0.0"
You can’t perform that action at this time.
0 commit comments