Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
251 views
in Technique[技术] by (71.8m points)

ios - SKStore?Review?Controller, How to use it in a correct way?

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. SKStore?Review?Controller is only work for ios 10.3 what i read, could anybody explain with little bit of code in swift and objective c.

UPDATE:

Actually I'm confused about calling the method request?Review(), Where do i need to call this method? in rootViewController's viewDidLoad or in appDelegate's didFinishlaunching ?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

SKStoreReviewController is available in iOS 10.3 and later.

According to APPLE's Documents:

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.

Inorder to display Rate/Review inside the app, you have to add StoreKitframework.

Please find the Sample code for both language:

Objective C:

#import <StoreKit/StoreKit.h>

- (void)DisplayReviewController {
    if([SKStoreReviewController class]){
       [SKStoreReviewController requestReview] ;
    }
}

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()
    }
}

Update: Ask for a rating only after the user has demonstrated engagement with your app


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...