Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/in_app_purchase/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.0+5

* iOS: Support unsupported UserInfo value types on NSError.

## 0.2.0+4

* Fixed code error in `README.md` and adjusted links to work on Pub.
Expand Down
17 changes: 12 additions & 5 deletions packages/in_app_purchase/ios/Classes/FIAObjectTranslator.m
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,18 @@ + (NSDictionary *)getMapFromNSError:(NSError *)error {
if (!error) {
return nil;
}
return @{
@"code" : @(error.code),
@"domain" : error.domain ?: @"",
@"userInfo" : error.userInfo ?: @{}
};
NSMutableDictionary *userInfo = [NSMutableDictionary new];
for (NSErrorUserInfoKey key in error.userInfo) {
id value = error.userInfo[key];
if ([value isKindOfClass:[NSError class]]) {
userInfo[key] = [FIAObjectTranslator getMapFromNSError:value];
} else if ([value isKindOfClass:[NSURL class]]) {
userInfo[key] = [value absoluteString];
} else {
userInfo[key] = value;
}
}
return @{@"code" : @(error.code), @"domain" : error.domain ?: @"", @"userInfo" : userInfo};
}

@end