Luis Felipe Luis Felipe - 6 months ago 69
iOS Question

How can I add a link for a rate button with swift?

First I don't know how to get the link before I submit my app, and if the link is for each country app store or is it universal?

then I don't know if the way to do it is just by putting the link there like:

@IBAction func rate(sender: AnyObject) {
UIApplication.sharedApplication().openURL(NSURL(string : "webLinkHere")!)
}


Or should I use another way to do this?

Thanks

Answer

You can use the following function and replace the APP_ID with your one. Calling this function will open the app in app store link and user will see the Review page where he can click and write a review easily.

func rateApp(){
   UIApplication.sharedApplication().openURL(NSURL(string : "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=\(APP_ID)&onlyLatestVersion=true&pageNumber=0&sortOrdering=1)")!);
}