I have a macOS Swift app where I am using local notifications. Here is a small methode for sending these:
func sendPushMessage(title: String, message: String, userInfo: [String:Any]) {
let notification: NSUserNotification = NSUserNotification()
notification.title = title
notification.informativeText = message
notification.userInfo = userInfo
notification.soundName = NSUserNotificationDefaultSoundName
notification.deliveryDate = Date()
self.center.scheduledNotifications = [notification]
}
This works for a long time and I have received all my notification (as well all notifications were shown in notification center). But actually the latest notification overrides the previous one. Let's say there is only one notification slot that always get overridenn with the latest notification.
In my notification center there is also only a single notification visible (the latest) instead of all received notifications. I have no idea when this "stops working" but I think one or two month ago? I am still on 10.13.6 high sierra.
The notification settings are correct.
I have no idea whatg I have done "wrong".
Fixed the issue by changing notification order (in notification settings) to manually by app and then it worked. After that I could change it back to newest and still working. Was only a bug in macOS for sure.
As refer documentation, you should set different identifier for each notification.
The identifier is unique to a notification. A notification delivered
with the same identifier as an existing notification replaces the
existing notification rather than causing the display of a new
notification.
You can set like that
notification.identifier = "yourIdentifier"
I am working on accepting a CKShare in a macOS app in Swift 4. I've already done all the following:
Create the CKShare and save it with its rootRecord to CloudKit
Add a participant (CKShare.Participant)
I've confirmed that the CKShare is on the CloudKit server and that the person I invited has access to it. Here's a screenshot: https://d.pr/i/0sMFQq
When I click the share link associated with the CKShare, it opens my app, but nothing happens and userDidAcceptCloudKitShareWith doesn't fire.
func application(_ application: NSApplication, userDidAcceptCloudKitShareWith metadata: CKShareMetadata) {
print("Made it!") //<-- This never gets logged :(
let shareOperation = CKAcceptSharesOperation(shareMetadatas: [metadata])
shareOperation.qualityOfService = .userInteractive
shareOperation.perShareCompletionBlock = {meta, share, error in
print("meta \(meta)\nshare \(share)\nerror \(error)")
}
shareOperation.acceptSharesCompletionBlock = { error in
if let error = error{
print("error in accept share completion \(error)")
}else{
//Send your user to where they need to go in your app
print("successful share:\n\(metadata)")
}
}
CKContainer.default().add(shareOperation)
}
Is there some kind of URL scheme I have to include in my info.plist? Or perhaps a protocol I need to conform to in my NSApplicationDelegate delegate? I can't, for the life of me, figure out what to do. Thanks in advance!
Update
I've tried a few more things on this. When I open the share link in a web browser, I see this:
Clicking OK makes the screen fade away to this:
Not particularly helpful. :) After doing this, the participant's status in CloudKit is still Invited, so the share still hasn't been accepted.
When I click on a share link within Messages, I am shown a popup like this:
After I click open, a new copy of my app shows up in the dock, then the app suddenly closes. The crash log states:
Terminating app due to uncaught exception 'CKException', reason: 'The application is missing required entitlement com.apple.developer.icloud-services'
I've tried turning iCloud off and on again in the Capabilities section of Xcode, but nothing changes. I know this exception can't be right because I can start my app normally and use CloudKit all day long. Only the CKShare causes this crash.
This is a mess. Save me, Obi-wan Kenobi, you're my only hope.
Yes,
You need to add this to your info.plist.
<key>CKSharingSupported</key>
<true/>
** EDITED ANSWER **
I use this code to share, I don't do it manually... not sure if this is an option under OS X I must confess. I am using iOS.
let share = CKShare(rootRecord: record2S!)
share[CKShareTitleKey] = "My Next Share" as CKRecordValue
share.publicPermission = .none
let sharingController = UICloudSharingController(preparationHandler: {(UICloudSharingController, handler:
#escaping (CKShare?, CKContainer?, Error?) -> Void) in
let modifyOp = CKModifyRecordsOperation(recordsToSave:
[record2S!, share], recordIDsToDelete: nil)
modifyOp.savePolicy = .allKeys
modifyOp.modifyRecordsCompletionBlock = { (record, recordID,
error) in
handler(share, CKContainer.default(), error)
}
CKContainer.default().privateCloudDatabase.add(modifyOp)
})
sharingController.availablePermissions = [.allowReadWrite,
.allowPrivate]
sharingController.delegate = self
sharingController.popoverPresentationController?.sourceView = self.view
DispatchQueue.main.async {
self.present(sharingController, animated:true, completion:nil)
}
This presents an activity controller in which you can choose say email and then send a link. You might also want to watch this video, focus on cloudKit JS right at the beginning.
Watch this WWDC video too https://developer.apple.com/videos/play/wwdc2015/710/
It talks about the cloudkit JSON API, using it you can query what has and what hasn't been shared in a terminal window/simple script perhaps. I did the same when using dropbox API a few years back. Hey you can even use the cloudkit JSON API within your code in place of the native calls.
I finally got it to work! I did all of the following:
Deleted my app from ~/Library/Developer/Excode/DerivedData
Made sure I had no other copies of my app archived anywhere on my machine.
Said a prayer.
Rebooted.
Sheesh, that was rough. :)
If your app is a Mac Catalyst app running on any version of macOS Catalina at least up to and including 10.15.4 Beta 1, a UIApplicationDelegate userDidAcceptCloudKitShareWith method will never be invoked.
After some significant debugging, we discovered that the MacCatalyst UIKit doesn’t even have an implementation for userDidAcceptCloudKitShareWithMetadata in its UIApplication delegate. It’s not broken, it’s just not there. So, at least temporarily, our workaround is the following, which seems to work, even if it’s very inelegant:
// Add CloudKit sharing acceptance handling to UINSApplicationDelegate, which is missing it.
#if targetEnvironment(macCatalyst)
extension NSObject {
#objc func application(_ application: NSObject, userDidAcceptCloudKitShareWithMetadata cloudKitShareMetadata: CKShare.Metadata) {
YourClass.acceptCloudKitShare(cloudKitShareMetadata: cloudKitShareMetadata)
}
}
#endif
If you are using a SceneDelegate, implement the delegate callback there, instead of on AppDelegate.
func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) {
// ...
}
You need to create the app delegate for your SwiftUI app using #NSApplicationDelegateAdaptor:
#main
struct Sharing_ServiceApp: App
{
#NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene
{
WindowGroup
{
ContentView()
.environment(\.managedObjectContext, persistenceController.container.viewContext)
}
}
}
I put that line in and my code instantly started receiving the share requests.
I'm not sure if it is technical issues. I tried to implement a scheduled local notification by calling this:
// Schedule the notification ********************************************
if UIApplication.sharedApplication().scheduledLocalNotifications.count == 0 {
let notification = UILocalNotification()
notification.alertBody = "This is local push notification"
notification.soundName = UILocalNotificationDefaultSoundName
notification.fireDate = NSDate()
notification.category = categoryID
notification.repeatInterval = NSCalendarUnit.Minute
UIApplication.sharedApplication().scheduleLocalNotification(notification)
}
from
func application(application: UIApplication, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings) {
}
It works fine. However, when I revert the code to the origin version without any line of codes related to the scheduleLocalNotification() the local notification still running.
I can't stop it even I clean the project/remove the application from devices before a rebuild.
Please help if possible, thank you!
You have created a repeating local notification and handed it to the system. At that point it is out of your hands. You have told the system to repeat this notification, and it will do so, forever.
Your only choice at this point is to delete your app.
What you have done is a classic mistake — one, unfortunately, that many apps do in fact make. And I have had to delete those apps from my device as well, as there is no other way to stop the repeating notification.
The right thing to do would have been to build into your app a cancelation of that local notification, i.e. you stop the notification in code. For example, you tell the UIApplication shared instance to cancelAllLocalNotifications. But you failed to do that.
I have a bare-bones app to play with push notifications. I have the Notification Service Extension working. I can send a remote notification with an image URL and have it load.
I can't seem to get Notification Content Extension working. I've gone through multiple tutorials and they all say, just create a Notification Content Extension from the target menu and then inside the Notification Content Extensions Info.plist set the
UNNotificationCategory
to some string. Then when you push the notification, inside the "aps" json-block make sure to have category the same as UNNotificationCategory.
When I receive a notification, I try to swipe it down, left or right and nothing really happens. However, the service extension is working great.
I am using an iPhone 5 with ios 10 and XCode 8.0. I read that at one point only devices with 3d touch could view the content extension but that has since changed since xCode 8 is out of beta.
Any ideas? How can I go about debugging this? I've tried running the app with the Notification Extension selected and printing out stuff inside
didReceive
but am not having any luck.
Make sure to set the Extension's deployment target to the same as your Application target.
Please check if you set the category identifier in your UNMutableNotificationContent() For e.g.
let content = UNMutableNotificationContent()
content.categoryIdentifier = "awesomeNotification"
where "awesomeNotification" is the identifier for your UNNotificationCategory
Such problem. iOS Content Extension work fine with iPhone 5s, SE, iPad2mini, but doesn't work with iPhoine 5, 5c:
UNUserNotificationCenter.current().supportsContentExtensions is false on iPhoine 5, 5c
Despite what I read elsewhere on stackoverflow and online, expanding the push notification did not work on an iPhone 5 and IOS 10. I borrowed an iPhone 6+ and my code worked fine.
For me it was due to changing signing certificates. I was able to resolve it by:
Deleting the app (and all apps in app group)
Restarting phone
Quitting Xcode
Cleaning project
Running again
I want to put a "rate/review this app" feature into my app.
Is there a way to link directly to the screen in the app store where they review the app? So the customer doesn't have to click through the main app link. Thanks.
EDIT: starting a bounty on this due to the lack of response. Just to make sure it is crystal clear: I am aware that I can link to my app's page in the store, and ask the user to click from there to the "review this app" screen. The question is whether it is possible to link directly to the "review this app" screen so they don't have to click through anything.
For versions lower than iOS 7 use the old one:
itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=YOUR_APP_ID
This works on my end (Xcode 5 - iOS 7 - Device!):
itms-apps://itunes.apple.com/app/idYOUR_APP_ID
For iOS 8 or later:
itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=YOUR_APP_ID&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software
Code snippet (you can just copy & paste it):
#define YOUR_APP_STORE_ID 545174222 //Change this one to your ID
static NSString *const iOS7AppStoreURLFormat = #"itms-apps://itunes.apple.com/app/id%d";
static NSString *const iOSAppStoreURLFormat = #"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d";
[NSURL URLWithString:[NSString stringWithFormat:([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f)? iOS7AppStoreURLFormat: iOSAppStoreURLFormat, YOUR_APP_STORE_ID]]; // Would contain the right link
Update:
Swift 5.1, Xcode 11
Tested on Real Device iOS 13.0 (Guarantee to work)
import StoreKit
func rateApp() {
if #available(iOS 10.3, *) {
SKStoreReviewController.requestReview()
} else {
let appID = "Your App ID on App Store"
let urlStr = "https://itunes.apple.com/app/id\(appID)" // (Option 1) Open App Page
let urlStr = "https://itunes.apple.com/app/id\(appID)?action=write-review" // (Option 2) Open App Review Page
guard let url = URL(string: urlStr), UIApplication.shared.canOpenURL(url) else { return }
if #available(iOS 10.0, *) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(url) // openURL(_:) is deprecated from iOS 10.
}
}
}
EDIT: iOS 11 Solution
This is the solution to my original answer (see below). When using the iOS 11 the following link format will work:
https://itunes.apple.com/us/app/appName/idAPP_ID?mt=8&action=write-review
Simply replace APP_ID with your specific app ID. The key to make the link work is the country code. The link above uses the us code but it actually doesn't matter which code is used. The user will automatically be redirected to his store.
iOS 11 Update:
It seems that none of the solutions presented in the other answers to get directly to the Review Page works on iOS 11.
The problem most likely is, that an app page in the iOS 11 App Store app does NOT have a Review Tab anymore. Instead the reviews are now located directly below the description and the screenshots. Of course it could still be possible to reach this section directly (e.g. with some kind of anchor), but it seems that this is not supported / intended by Apple.
Using one of the following links does not work anymore. They still bring the users to the App Store app but only to a blank page:
itms-apps://itunes.apple.com/app/idYOUR_APP_ID?action=write-review
itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=YOUR_APP_ID&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software
Everyone how still uses these links should update their apps ASAP, because referring the users to a blank App Store page is most likely not what you intended.
Links which do not refer to the Review page but to the App page, still work however, e.g.
itms-apps://itunes.apple.com/app/idYOUR_APP_ID (same as above, but without write-review parameter)
So, you can still get the users to your apps Store page, but not directly to the review section anymore. Users now have to scroll down to the review section manually to leave their feedback.
Without a question this a "great and awesome benefit for User Experience and will help developers to engage users to leave high quality reviews without annoying them". Well done Apple...
Everything, written above is correct. Just a sample to insert into the app and change {YOUR APP ID} to actual app id, taken from iTunesconnect to show the Review page. Please note, as it was commented above, that it is not working on the Simulator - just the device.
Correcting because of iOS 7 changes.
Correcting for iOS 10+ openURL changes
For iOS 13.6+ review URL is accessible with the one, used before version 6.0. It drives directly to the review page. Code updated
NSString * appId = #"{YOUR APP ID}";
NSString * theUrl = [NSString stringWithFormat:#"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%#&onlyLatestVersion=true&pageNumber=0&sortOrdering=1&type=Purple+Software",appId];
int vers = (int) [[UIDevice currentDevice].systemVersion integerValue];
if (vers > 6 && vers < 12 ) theUrl = [NSString stringWithFormat:#"itms-apps://itunes.apple.com/app/id%#",appId];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:theUrl] options:#{} completionHandler:nil];
All above approaches are correct, but nowadays using SKStoreProductViewController leads to better user experience. To use it you need to do the following:
implement SKStoreProductViewControllerDelegate protocol in your app delegate
add required productViewControllerDidFinish method:
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {
[viewController dismissViewControllerAnimated: YES completion: nil];
}
Check if SKStoreProductViewController class is available and either show it or switch to the App Store:
extern NSString* cAppleID; // must be defined somewhere...
if ([SKStoreProductViewController class] != nil) {
SKStoreProductViewController* skpvc = [[SKStoreProductViewController new] autorelease];
skpvc.delegate = self;
NSDictionary* dict = [NSDictionary dictionaryWithObject: cAppleID forKey: SKStoreProductParameterITunesItemIdentifier];
[skpvc loadProductWithParameters: dict completionBlock: nil];
[[self _viewController] presentViewController: skpvc animated: YES completion: nil];
}
else {
static NSString* const iOS7AppStoreURLFormat = #"itms-apps://itunes.apple.com/app/id%#";
static NSString* const iOSAppStoreURLFormat = #"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%#";
NSString* url = [[NSString alloc] initWithFormat: ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0f) ? iOS7AppStoreURLFormat : iOSAppStoreURLFormat, cAppleID];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
}
Solution for iOS 11
Short App Store URLs do not correctly open the "write a review" interface in the new iOS 11 App Store. For example, this does not work:
https://itunes.apple.com/app/id333903271?mt=8&action=write-review
The workaround is to include a two-letter country code and app name in the URL, such as this:
https://itunes.apple.com/us/app/twitter/id333903271?mt=8&action=write-review
or
itms-apps://itunes.apple.com/us/app/twitter/id333903271?mt=8&action=write-review
You can get the full URL of your app from here: https://linkmaker.itunes.apple.com/
This successfully opens the "write a review" interface in the iOS 11 App Store.
Edit: As #Theo mentions below, the country code does not need to be localized and the app name in the URL does not need to be updated if the app name changes.
Hopefully Apple will fix this soon for the shorter URL. See rdar://34498138
Swift 2 version
func jumpToAppStore(appId: String) {
let url = "itms-apps://itunes.apple.com/app/id\(appId)"
UIApplication.sharedApplication().openURL(NSURL(string: url)!)
}
All previous links no more direct to "Reviews" tab,
This link would direct to "Reviews Tab" directly:
https://itunes.apple.com/app/viewContentsUserReviews?id=AppID
or
itms-apps://itunes.apple.com/app/viewContentsUserReviews?id=AppID
There is a new way to do this in iOS 11+ (new app store). You can open the "Write a Review" dialog directly.
iOS 11 example:
itms-apps://itunes.apple.com/us/app/id1137397744?action=write-review
or
https://itunes.apple.com/us/app/id1137397744?action=write-review
Notes:
A country code is required (/us/). It can be any country code, doesn't matter.
Change the app id (1137397744) to your app id (get it from iTunes URL).
If you want to support older iOS version (pre 11), you'll want some conditional logic to only link this way if the OS version is great than or equal to 11.
Using this URL was the perfect solution for me. It takes the user directly to the Write a Review section. Credits to #Joseph Duffy. MUST TRY
URL = itms-apps://itunes.apple.com/gb/app/idYOUR_APP_ID_HERE?action=write-review&mt=8
Replace YOUR_APP_ID_HERE with your AppId
For a sample code try this :
Swift 3, Xcode 8.2.1 :
let openAppStoreForRating = "itms-apps://itunes.apple.com/gb/app/id1136613532?action=write-review&mt=8"
if let url = URL(string: openAppStoreForRating), UIApplication.shared.canOpenURL(url) {
UIApplication.shared.openURL(url)
} else {
showAlert(title: "Cannot open AppStore",message: "Please select our app from the AppStore and write a review for us. Thanks!!")
}
Here showAlert is a custom function for an UIAlertController.
You can use this link in your url launcher function
https://apps.apple.com/app/APP_ID?action=write-review
In iOS7 the URL that switch ur app to App Store for rate and review has changed:
itms-apps://itunes.apple.com/app/idAPP_ID
Where APP_ID need to be replaced with your Application ID.
For iOS 6 and older, URL in previous answers are working fine.
Source: Appirater
Enjoy Coding..!!
Starting from iOS 10.3 you can attach action=write-review query item to your https://itunes.apple.com/... and https://appsto.re/... URLs. On iOS 10.3 and up it will open Write a review automatically, while on lower iOS releases will fall back to the app's App Store page.
iOS 11 update:
Use Apple's linkmaker: linkmaker.itunes.apple.com
and append &action=write-review, seems to be the most safe way to go.
iOS 4 has ditched the "Rate on Delete" function.
For the time being the only way to rate an application is via iTunes.
Edit: Links can be generated to your applications via iTunes Link Maker. This site has a tutorial.
NSString *url = [NSString stringWithFormat:#"https://itunes.apple.com/us/app/kidsworld/id906660185?ls=1&mt=8"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
Swift 2 version that actually takes you to the review page for your app on both iOS 8 and iOS 9:
let appId = "YOUR_APP_ID"
let url = "itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=\(appId)"
UIApplication.sharedApplication().openURL(NSURL(string: url)!)
For >= iOS8: (Simplified #EliBud's answer).
#define APP_STORE_ID 1108885113
- (void)rateApp{
static NSString *const iOSAppStoreURLFormat = #"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=%d";
NSURL *appStoreURL = [NSURL URLWithString:[NSString stringWithFormat:iOSAppStoreURLFormat, APP_STORE_ID]];
if ([[UIApplication sharedApplication] canOpenURL:appStoreURL]) {
[[UIApplication sharedApplication] openURL:appStoreURL];
}
}
I'm having the same issue in iOS 10 and I could open the iTunes rate section calling:
http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=YOUR_APP_ID&pageNumber=0&sortOrdering=2&type=Purple+Software&mt=7
Basically it changed the last url var to "mt=7"
Cheers
quote from Apple Developer Documentation
In addition, you can continue to include a persistent link in the
settings or configuration screens of your app that deep-links to your
App Store product page. To automatically open a page on which users
can write a review in the App Store, append the query parameter
action=write-review to your product URL.
So the URL would be the following:
itms-apps://itunes.apple.com/app/idYOUR_APP_ID?action=write-review
let rateUrl = "itms-apps://itunes.apple.com/app/idYOUR_APP_ID?action=write-review"
if UIApplication.shared.canOpenURL(rateUrl) {
UIApplication.shared.openURL(rateUrl)
}
Link to any App in the AppStore via SKStoreProductViewController
It is easy to link to your app at the app store via SKStoreProductViewController. But I struggled a little bit, so I decided to show here the whole process and some code necessary. This technique also makes sure that always the correct store will be used (important for localized apps).
To present the product screen of any app of the app store within your app with any of your apps ViewControllers follow this steps:
Add the StoreKit.framework in your project settings (Target, Build Phases -> Link Binary With Libraries
Import StoreKit into the ViewController class
Make your ViewController conforms this protocol
SKStoreProductViewControllerDelegate
Create the method to present the StoreView with the product screen you want
Dismiss the StoreView
But most important: This - for some reason - does not work in the simulator - you have to build and install on a real device with internet connectivity.
Adding the StorKit.framework to your project:
SWIFT 4: This is the code according to the described steps ahead:
// ----------------------------------------------------------------------------------------
// 2. Import StoreKit into the ViewController class
// ----------------------------------------------------------------------------------------
import StoreKit
// ...
// within your ViewController
// ----------------------------------------------------------------------------------------
// 4. Create the method to present the StoreView with the product screen you want
// ----------------------------------------------------------------------------------------
func showStore() {
// Define parameter for product (here with ID-Number)
let parameter : Dictionary<String, Any> = [SKStoreProductParameterITunesItemIdentifier : NSNumber(value: 742562928)]
// Create a SKStoreProduktViewController instance
let storeViewController : SKStoreProductViewController = SKStoreProductViewController()
// set Delegate
storeViewController.delegate = self
// load product
storeViewController.loadProduct(withParameters: parameter) { (success, error) in
if success == true {
// show storeController
self.present(storeViewController, animated: true, completion: nil)
} else {
print("NO SUCCESS LOADING PRODUCT SCREEN")
print("Error ? : \(error?.localizedDescription)")
}
}
}
// ...
// ----------------------------------------------------------------------------------------
// 3. Make your ViewController conforming the protocol SKStoreProductViewControllerDelegate
// ----------------------------------------------------------------------------------------
extension ViewController : SKStoreProductViewControllerDelegate {
// ----------------------------------------------------------------------------------------
// 5. Dismiss the StoreView
// ----------------------------------------------------------------------------------------
func productViewControllerDidFinish(_ viewController: SKStoreProductViewController) {
print("RECEIVED a FINISH-Message from SKStoreProduktViewController")
viewController.dismiss(animated: true, completion: nil)
}
}
Here is the code that I am using in my app;
-(void)rateApp {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[#"itms-apps://itunes.apple.com/app/" stringByAppendingString: #"id547101139"]]];
}
The accepted answer failed to load the "Reviews" tab. I found below method to load the "Review" tab without "Details" tab.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: #"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id={APP_ID}&pageNumber=0&sortOrdering=2&mt=8"]];
Replace {APP_ID} with your app apps store app id.
SWIFT 3
fileprivate func openAppStore() {
let appId = "YOUR_APP_ID"
let url_string = "itms-apps://itunes.apple.com/app/id\(appId)"
if let url = URL(string: url_string) {
UIApplication.shared.openURL(url)
}
}
This works fine on iOS 9 - 11.
Haven't tested on earlier versions.
[NSURL URLWithString:#"https://itunes.apple.com/app/idXXXXXXXXXX?action=write-review"];
Starting in iOS 10.3:
import StoreKit
func someFunction() {
SKStoreReviewController.requestReview()
}
but its has been just released with 10.3, so you will still need some fallback method for older versions as described above
Swift 5 Tested in iOS14
Opens the review window with 5 stars selected
private func openReviewInAppStore() {
let rateUrl = "itms-apps://itunes.apple.com/app/idYOURAPPID?action=write-review"
if UIApplication.shared.canOpenURL(URL.init(string: rateUrl)!) {
UIApplication.shared.open(URL.init(string: rateUrl)!, options: [:], completionHandler: nil)
}
}
If your app has been approved for Beta and it's not live then the app review link is available but it won't be live to leave reviews.
Log into iTunes Connect
Click My Apps
Click the App Icon your interested in
Make sure your on the App Store page
Go toApp Information section (it should automatically take you there)
At the bottom of that page there is a blue link that says View on App Store. Click it and it will open to an a blank page. Copy what's in the url bar at the top of the page and that's your app reviews link. It will be live once the app is live.
Know you apple app id, it is the numeric digits in your itunes app url after id field.
Something like this : https://itunes.apple.com/app/id148688859, then 148688859 is your app id.
Then, Redirect to this url using your correct app id : https://itunes.apple.com/app/idYOUR_APP_ID?action=write-review.