
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
Launching the App Store from an iOS application
In this post we will learn how to open app store from iOS application.
In this example we will open app store and show Facebook app on store. You can open your app if you want just by changing the ID to your app id.
Lets do it.
Step 1 − Open Xcode → New Project → Single View Application → Let’s name it “OpenAppStore”
Step 2 − Open Main.storyboard and add a button as shown below.
Step 3 − Attach one @IBAction for the button for click event. Name the function as openAppstoreClicked.
Step 4 − In openAppstoreClicked we will write the code to open the app store. We will use openURL api to do so.
In the openAppstoreClicked method write following line of code
@IBAction func openAppstoreClicked(_ sender: Any) { if let url = URL(string: "https://itunes.apple.com/in/app/facebook/id284882215?mt=8") { UIApplication.shared.open(url, options: [:], completionHandler: nil) } }
In the above code you can see we have passed the ‘facebook’ as app name and ID of the Facebook app. If you want, you can pass your app name and app ID. Then the button click will open app store with your app.
Step 4 − Run the app and click on ‘Open App Store’ button. The app store will be opened as shown in the picture below
- Related Articles
- How do I programmatically “restart” an iOS app?
- How to create CollectionView Layout in an iOS App?
- How to get the build/version number of an iOS App?
- Using an Angular app as SAP Fiori application
- How much does it cost to make an iOS app?
- How to create Tab Bar Layout in an iOS App?
- How can I set an icon for my iOS application?
- How to make an HTTP request on iOS App using Swift?
- How to create a WebView in an iOS App using Swift?
- What is the best iOS app for education?
- How do I display the current date and time in an iOS application?
- What are the common execution iOS Application Lifecycle?
- How to take a screenshot of my iOS application in the iOS simulator?
- How to make an HTTP POST request on iOS App using Swift?
- How to load and display an image on iOS App using Swift?
