RadoTonev
RadoTonev

Reputation: 45

How to test iOS "Rate My App" functionality

I am trying to add "Rate my App" functionality to an iOS app that has not been released yet.

I have a simple function, like shown below:

 let alert = UIAlertController(title: "Rate Us", message: "Thanks for using <APP NAME>", preferredStyle: UIAlertControllerStyle.Alert)
    alert.addAction(UIAlertAction(title: "Rate <APP NAME>", style: UIAlertActionStyle.Default, handler: { alertAction in
        UIApplication.sharedApplication().openURL(NSURL(string : "itms-apps://itunes.apple.com/app/<ITUNES CONNECT APP ID>")!)
        alert.dismissViewControllerAnimated(true, completion: nil)
    }))
    alert.addAction(UIAlertAction(title: "No Thanks", style: UIAlertActionStyle.Default, handler: { alertAction in
        NSUserDefaults.standardUserDefaults().setBool(true, forKey: "neverRate")
        alert.dismissViewControllerAnimated(true, completion: nil)
    }))
    alert.addAction(UIAlertAction(title: "Maybe Later", style: UIAlertActionStyle.Default, handler: { alertAction in
        alert.dismissViewControllerAnimated(true, completion: nil)
    }))
    self.presentViewController(alert, animated: true, completion: nil)

How can I test if this works?

My app is not submitted yet, and I want to make sure the code is working.

I get the alert and when I click on Rate Us, it redirects me to the app store:

App Store Image Shown

Error in console:

2016-02-24 18:38:00.302 <APP NAME>[2212:808041] _BSMachError: (os/kern) invalid capability (20)
2016-02-24 18:38:00.305 <APP NAME>[2212:808256] _BSMachError: (os/kern) invalid name (15)

I am not sure if this means the feature doesn't work or something.

Any help is greatly appreciated.

Upvotes: 3

Views: 1742

Answers (2)

Jobins John
Jobins John

Reputation: 1278

There is an excellent library for the purpose that you are looking for. You can use iRate library. All the details can be found from the following link

https://github.com/nicklockwood/iRate

The library checks whether the user has reviewed for a particular version and if not it prompts the user to rate the app. The period of prompt alerts can be configured. Also the feature can be tested while development provided you have a live app in the store.

I hope this helps...

Upvotes: 3

I checked your code & nothing wrong there. Also URL you have passed is correct. It might happen than it will not work on some OS version or some particular devices.

So in that case just try this URL in place of your URL:

itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=YOUR+AppID

This is tried & tested in 1 of my App.

Note:

  • If you want to do testing than just place AppID of any live Application. Once you done with testing than you just need to pass AppID of your App. Thats It!

Hope it will work for you.

Upvotes: 1

Related Questions