

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- Using an Angular app as SAP Fiori application
- How to get the build/version number of an iOS App?
- How to create CollectionView Layout in an iOS App?
- What is the best iOS app for education?
- How much does it cost to make an iOS app?
- How do I programmatically “restart” 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 take a screenshot of my iOS application in the iOS simulator?
- How do I display the current date and time in an iOS application?
- How to make an HTTP request on iOS App using Swift?
- How to create a WebView in an iOS App using Swift?
- How to check notifications status for the iOS App
- How to launch any arbitrary iPhone application from within another app?
- How to Launch an application from another application on Android