简体   繁体   English

如何测试iOS“我的应用评分”功能

[英]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. 我正在尝试向尚未发布的iOS应用程序添加“为我的应用程序评分”功能。

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 显示的App Store图片

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. 任何帮助是极大的赞赏。

There is an excellent library for the purpose that you are looking for. 有一个出色的图书馆供您寻找。 You can use iRate library. 您可以使用iRate库。 All the details can be found from the following link 所有详细信息都可以从以下链接中找到

https://github.com/nicklockwood/iRate 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... 我希望这有帮助...

I checked your code & nothing wrong there. 我检查了您的代码,没有错。 Also URL you have passed is correct. 另外,您传递的URL是正确的。 It might happen than it will not work on some OS version or some particular devices. 可能会发生,而不是在某些OS版本或某些特定设备上将无法运行。

So in that case just try this URL in place of your URL: 因此,在这种情况下,请尝试使用以下URL代替您的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. 如果您要进行测试,而不仅仅是放置任何活动应用程序的AppID。 Once you done with testing than you just need to pass AppID of your App. 完成测试后,您只需传递您的App的AppID。 Thats It! 而已!

Hope it will work for you. 希望它对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM