Open AppStore through button
Here. But I highly suggest you learn the basics of Swift!
UIApplication.sharedApplication().openURL(NSURL(string: "itms://itunes.apple.com/de/app/x-gift/id839686104?mt=8&uo=4")!)
If you wanna open the AppStore in Swift 5:
if let url = URL(string: "itms-apps://itunes.apple.com/app/id1629135515") {
UIApplication.shared.open(url)
}
How to link to apps on the app store
Edited on 2016-02-02
Starting from iOS 6 SKStoreProductViewController class was introduced. You can link an app without leaving your app. Code snippet in Swift 3.x/2.x and Objective-C is here.
A SKStoreProductViewController object presents a store that allows the
user to purchase other media from the App Store. For example, your app
might display the store to allow the user to purchase another app.
From News and Announcement For Apple Developers.
Drive Customers Directly to Your App
on the App Store with iTunes Links
With iTunes links you can provide your
customers with an easy way to access
your apps on the App Store directly
from your website or marketing
campaigns. Creating an iTunes link is
simple and can be made to direct
customers to either a single app, all
your apps, or to a specific app with
your company name specified.To send customers to a specific
application:
http://itunes.com/apps/appnameTo send
customers to a list of apps you have
on the App Store:
http://itunes.com/apps/developernameTo send customers to a specific app
with your company name included in the
URL:
http://itunes.com/apps/developername/appname
Additional notes:
You can replace http://
with itms://
or itms-apps://
to avoid redirects.
Please note that itms://
will send the user to the iTunes store and itms-apps://
with send them to the App Store!
For info on naming, see Apple QA1633:
https://developer.apple.com/library/content/qa/qa1633/_index.html.
Edit (as of January 2015):
itunes.com/apps links should be updated to appstore.com/apps. See QA1633 above, which has been updated. A new QA1629 suggests these steps and code for launching the store from an app:
- Launch iTunes on your computer.
- Search for the item you want to link to.
- Right-click or control-click on the item's name in iTunes, then choose "Copy iTunes Store URL" from the pop-up menu.
- In your application, create an
NSURL
object with the copied iTunes URL, then pass this object toUIApplication
' sopenURL
: method to open your item in the App Store.
Sample code:
NSString *iTunesLink = @"itms://itunes.apple.com/app/apple-store/id375380948?mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
iOS10+:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink] options:@{} completionHandler:nil];
Swift 4.2
let urlStr = "itms-apps://itunes.apple.com/app/apple-store/id375380948?mt=8"
if #available(iOS 10.0, *) {
UIApplication.shared.open(URL(string: urlStr)!, options: [:], completionHandler: nil)
} else {
UIApplication.shared.openURL(URL(string: urlStr)!)
}
how to open the app store when clicking button
Zenprogrammer79 if your using the iOS simulator the link won't work because there is no App Store on the simulator but it should work on a real iOS device
Launching App Store from App in Swift
You have too many protocols in your URL. Get rid of https:
so the URL reads
itms-apps://itunes.apple.com/app/bars/id706081574
How to open app store in ios app?
Your URL can simply be:
https://itunes.apple.com/app/id<App ID Here>?mt=8
Better yet, use SKStoreProductViewController
so you can show the app in an App Store page without the need to leave your app.
And as of iOS 10.3 you can SKStoreReviewController
specifically to allow a user to post a review or rate an app.
Opening app store page to rate my app
Use openURL
to open the URL when a button is tapped. UIApplication Class Reference.
-(IBAction)appStoreButton:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://itunes.apple.com/app/id653287635"]];
}
Redirect to app store or google store after button click
Try this
<button onclick="myFunction()">Click me</button>
<script>
function myFunction() {
if(navigator.userAgent.toLowerCase().indexOf("iphone") > -1){ window.location.href = 'https://itunes.apple.com/my/app/flipbizz/idexampleapp'; }
if(navigator.userAgent.toLowerCase().indexOf("android") > -1){ window.location.href = 'https://play.google.com/store/apps/details?id=com.exampleapp'; }
//Update #2
if (!navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/)) {
window.location.href = 'https://www.google.com'; //Desktop Browser
}
}
</script>
Related Topics
What Privacy-Violating or Device-Changing Things How to Do on an Iphone
Calculate Uitableviewcell Height to Fit String
What Is Nsmanagedobjectcontext's Performblock: Used For
How to Set Image as a Title to Uinavigationbar
How to Loop Through Uitableview's Cells
Auto Layout to Dynamically Size Uilabel Width
iOS App Crashing Every Other Launch, Can't Find Error
Accessing the Host App Code from the Xcode 7 UI Test Target
Xcode Info.Plist Build Variable ${Product_Name:Rfc1034Identifier} Seems Completely Undocumented
iOS Simulator Display Scaled Incorrectly
Retrieve User Defaults Information from an Apple Watch
Converting a Vision Vntextobservation to a String
Differencebetween the App Id and the Bundle Id? Where Is the App Id in the Xcode Project
Saving PDF Files with Swift in iOS and Display Them
How to Build .Ipa for React Native
How to Add Constraint Between a View and the Top Layout Guide in a Xib File
Why Tesseract Ocr Library (Ios) Cannot Recognize Text at All