SKStore Review Controller,如何以正确的方式使用它? [英] SKStoreReviewController, How to use it in a correct way?
问题描述
我已经看到了一些答案但对它们不满意并且有了一些想法,但不知道如何正确使用它,以便它将以正确的方式执行,尽管我认为它应该在App代理中使用 didFinishLaunching
,但我想确定在Live应用程序中实现它之前没有任何喧嚣。
SKStore Review Controller
仅适用于我阅读的ios 10.3,任何人都可以用快速和客观的c解释一点代码。
I have seen some answer but not satisfied with them and got some idea, but don't know how to use it properly, so that it will execute in proper way, though i think it should be used in App delegates didFinishLaunching
, but i wanted to be sure before implement it in Live app without any hustle.
SKStoreReviewController
is only work for ios 10.3 what i read, could anybody explain with little bit of code in swift and objective c.
更新:
实际上我对调用方法感到困惑请求评论()
,我需要在哪里调用此方法?在 rootViewController
的 viewDidLoad
或 appDelegate
's didFinishlaunching
?
Actually I'm confused about calling the method requestReview()
, Where do i need to call this method? in rootViewController
's viewDidLoad
or in appDelegate
's didFinishlaunching
?
谢谢。
推荐答案
SKStoreReviewController
在iOS 10.3及更高版本中可用。
SKStoreReviewController
is available in iOS 10.3 and later.
根据APPLE的文件:
According to APPLE's Documents:
您可以要求用户在使用应用时对其进行评分或评论,
而不将其发送到App Store.You确定
用户体验中的点数,在该体验中调用API是有意义的,系统
负责其余部分。
You can ask users to rate or review your app while they're using it, without sending them to the App Store.You determine the points in the user experience at which it makes sense to call the API and the system takes care of the rest.
为了在应用程序内显示评分/评论,你必须添加 StoreKit
框架。
Inorder to display Rate/Review inside the app, you have to add StoreKit
framework.
请找到两种语言的示例代码:
Please find the Sample code for both language:
目标C:
#import <StoreKit/StoreKit.h>
- (void)DisplayReviewController {
if([SKStoreReviewController class]){
[SKStoreReviewController requestReview] ;
}
}
因为你可以做xCode 9:
since xCode 9 you can do:
#import <StoreKit/StoreKit.h>
- (void)DisplayReviewController {
if (@available(iOS 10.3, *)) {
[SKStoreReviewController requestReview];
}
}
Swift:
import StoreKit
func DisplayReviewController {
if #available( iOS 10.3,*){
SKStoreReviewController.requestReview()
}
}
这篇关于SKStore Review Controller,如何以正确的方式使用它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!