Git Product home page Git Product logo

Comments (7)

msd117 avatar msd117 commented on July 18, 2024 2

Facing the same issue... did you find any fix @Bradrickcruz

from cordova-plugin-apprate.

hoggMan avatar hoggMan commented on July 18, 2024 2

Same issue. Crashes the app on iOS 17 when choosing to rate now. "Call must be made on the main thread".

from cordova-plugin-apprate.

jellomaster avatar jellomaster commented on July 18, 2024 1

There haven't been updates to this plugin in over 2 years. You need to put the code into:
dispatch_async(dispatch_get_main_queue(), ^{
});

ex.. this should fix it:

- (void)launchAppStore:(NSString *) appId{
    [self.commandDelegate runInBackground:^{
        // Initialize Product View Controller
        dispatch_async(dispatch_get_main_queue(), ^{
            SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];

            // Configure View Controller
            [storeProductViewController setDelegate:self];
            [storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : appId} completionBlock:^(BOOL result, NSError *error) {
                if (error) {
                    NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
                } else {
                        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
                }
            }];
            [self.viewController presentViewController:storeProductViewController animated:YES completion:nil];
            
        });
    }];
}

from cordova-plugin-apprate.

msd117 avatar msd117 commented on July 18, 2024

@jellomaster Thanks I ll check this today

There haven't been updates to this plugin in over 2 years. You need to put the code into: dispatch_async(dispatch_get_main_queue(), ^{ });

ex.. this should fix it:

- (void)launchAppStore:(NSString *) appId{
    [self.commandDelegate runInBackground:^{
        // Initialize Product View Controller
        dispatch_async(dispatch_get_main_queue(), ^{
            SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];

            // Configure View Controller
            [storeProductViewController setDelegate:self];
            [storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : appId} completionBlock:^(BOOL result, NSError *error) {
                if (error) {
                    NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
                } else {
                        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
                }
            }];
            [self.viewController presentViewController:storeProductViewController animated:YES completion:nil];
            
        });
    }];
}

from cordova-plugin-apprate.

hoggMan avatar hoggMan commented on July 18, 2024

There haven't been updates to this plugin in over 2 years. You need to put the code into: dispatch_async(dispatch_get_main_queue(), ^{ });

ex.. this should fix it:

- (void)launchAppStore:(NSString *) appId{
    [self.commandDelegate runInBackground:^{
        // Initialize Product View Controller
        dispatch_async(dispatch_get_main_queue(), ^{
            SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];

            // Configure View Controller
            [storeProductViewController setDelegate:self];
            [storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : appId} completionBlock:^(BOOL result, NSError *error) {
                if (error) {
                    NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
                } else {
                        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
                }
            }];
            [self.viewController presentViewController:storeProductViewController animated:YES completion:nil];
            
        });
    }];
}

This worked for me! Thanks @jellomaster

from cordova-plugin-apprate.

westonganger avatar westonganger commented on July 18, 2024

@jellomaster it would be really nice if you could create a PR for this fix. We are always happy to have contributions, your time will not be wasted.

from cordova-plugin-apprate.

msd117 avatar msd117 commented on July 18, 2024

There haven't been updates to this plugin in over 2 years. You need to put the code into: dispatch_async(dispatch_get_main_queue(), ^{ });

ex.. this should fix it:

- (void)launchAppStore:(NSString *) appId{
    [self.commandDelegate runInBackground:^{
        // Initialize Product View Controller
        dispatch_async(dispatch_get_main_queue(), ^{
            SKStoreProductViewController *storeProductViewController = [[SKStoreProductViewController alloc] init];

            // Configure View Controller
            [storeProductViewController setDelegate:self];
            [storeProductViewController loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : appId} completionBlock:^(BOOL result, NSError *error) {
                if (error) {
                    NSLog(@"Error %@ with User Info %@.", error, [error userInfo]);
                } else {
                        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
                }
            }];
            [self.viewController presentViewController:storeProductViewController animated:YES completion:nil];
            
        });
    }];
}

Worked for me as well thanks @jellomaster

from cordova-plugin-apprate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.