Skip to content

Commit 60aaf3d

Browse files
committed
Fix error in IOS 17 in method launchAppStore
1 parent f25a476 commit 60aaf3d

2 files changed

Lines changed: 20 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Changelog
22

33
- Unreleased
4+
- [PR #315](https://github.com/pushandplay/cordova-plugin-apprate/pull/315) - Fix error in IOS 17 "Call must be made on main thread" in launchAppStore method
45
- [PR #313](https://github.com/pushandplay/cordova-plugin-apprate/pull/313) - Improve French translations
56
- [PR #310](https://github.com/pushandplay/cordova-plugin-apprate/pull/310) - Add translation for `pt-BR`
6-
7+
78
- 1.7.2
89
- [PR #302](https://github.com/pushandplay/cordova-plugin-apprate/pull/301) - Fix bug in setPreferences
910
- [PR #301](https://github.com/pushandplay/cordova-plugin-apprate/pull/301) - Typescript fixes
1011
- [PR #300](https://github.com/pushandplay/cordova-plugin-apprate/pull/300) - Fix iPad device recognition on iOS 13+
11-
12+
1213
- 1.7.1
1314
- [PR #293](https://github.com/pushandplay/cordova-plugin-apprate/pull/293) - Fix handling of `customLocale` object in `setPreferences`
1415
- [PR #289](https://github.com/pushandplay/cordova-plugin-apprate/pull/289) - Bugfix to ensure `getAppVersion()` runs after localstorage has been initialized
@@ -25,11 +26,11 @@
2526
- [PR #280](https://github.com/pushandplay/cordova-plugin-apprate/pull/280) - Removed iOS option `inAppReview` in favor of new option `reviewType`. Please update your app according to the updated documentation
2627
- [PR #280](https://github.com/pushandplay/cordova-plugin-apprate/pull/280) - Fixed race condition on `deviceready` events causing the module to not be fully initialized
2728
- [PR #281](https://github.com/pushandplay/cordova-plugin-apprate/pull/281) - feature: Android in-app review
28-
29+
2930
- 1.5.0
3031
- [PR #253](https://github.com/pushandplay/cordova-plugin-apprate/pull/253) - Remove iOS rating counter in favor of native approach
3132
- [PR #252](https://github.com/pushandplay/cordova-plugin-apprate/pull/252) - Postpone initial AppRate.init() until `deviceready`
32-
- [PR #239](https://github.com/pushandplay/cordova-plugin-apprate/pull/239) - Remove inappbrowser dependency adding support to choose between inappbrowser and safariviewcontroller
33+
- [PR #239](https://github.com/pushandplay/cordova-plugin-apprate/pull/239) - Remove inappbrowser dependency adding support to choose between inappbrowser and safariviewcontroller
3334
- [PR #244](https://github.com/pushandplay/cordova-plugin-apprate/pull/244) - Use ES5 var instead of ES6 const for better browser compatibility
3435
- [PR #231](https://github.com/pushandplay/cordova-plugin-apprate/pull/231) - Displaying store view page before it loads for improved UX
3536
- [PR #228](https://github.com/pushandplay/cordova-plugin-apprate/pull/228) - Add native support for windows platform rating

src/ios/CDVAppRate.m

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,22 @@ - (void)launchiOSReview:(CDVInvokedUrlCommand *)command {
6565

6666
- (void)launchAppStore:(NSString *) appId{
6767
[self.commandDelegate runInBackground:^{
68-
// Initialize Product View Controller
69-
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
70-
71-
// Configure View Controller
72-
[storeProductViewController setDelegate:self];
73-
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : appId} completionBlock:^(BOOL result, NSError *error) {
74-
if (error) {
75-
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
76-
} else {
77-
dispatch_async(dispatch_get_main_queue(), ^{
78-
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
79-
});
80-
}
81-
}];
82-
[self.viewController presentViewController:storeProductViewController animated:YES completion:nil];
8368
dispatch_async(dispatch_get_main_queue(), ^{
69+
// Initialize Product View Controller
70+
SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];
71+
72+
// Configure View Controller
73+
[storeProductViewController setDelegate:self];
74+
[storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : appId} completionBlock:^(BOOL result, NSError *error) {
75+
if (error) {
76+
NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
77+
} else {
78+
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
79+
}
80+
}];
81+
82+
[self.viewController presentViewController:storeProductViewController animated:YES completion:nil];
83+
8484
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
8585
});
8686
}];

0 commit comments

Comments
 (0)