Getting Started - Sample Swift (iOS) App and Tutorials
Important
Visual Studio App Center is scheduled for retirement on March 31, 2025. While you can continue to use Visual Studio App Center until it is fully retired, there are several recommended alternatives that you may consider migrating to.
In this tutorial, you'll learn how to set up a sample Swift app with App Center for iOS. Both Objective-C and Swift are supported.
Prerequisites
Sign in to GitHub and fork the repository
Sign in to your GitHub account.
Access the sample app's GitHub repository.
Click Fork at the top-right hand corner of the page, and clone the repository.
Integrate CocoaPods
Open a terminal and go to the sample app's directory.
Run the command below to install CocoaPods:
sudo gem install cocoapods
The included Podfile lists the dependencies in the source code. To install them, run the command below:
pod install
Open the
.xcworkspace
and press Run. The app should build without error.
Sign in to App Center
Open the App Center portal.
Click Connect with GitHub and sign in, or use another provider.
Create a new app in App Center
Click Add new app.
Name the app Sample iOS App.
Choose iOS and Objective-C / Swift.
Click Add new app at the bottom.
Replace the App Secret
In order for the sample app to send information to App Center, the app secret must be changed in Xcode.
Navigate to your app page in App Center by clicking it in the Apps list.
Go to the settings of your app by clicking Settings in the left sidebar.
Click the three dots in the upper right corner to open the context menu and then within it, click Copy app secret.
Open the
.xcworkspace
from the sample app folder.In AppDelegate.swift, edit the
didFinishLaunchingWithOptions
delegate method and paste your App Secret at the placeholder.Add, commit, and push changes to your forked repository. It can be done from the terminal, or a tool of your choice.
Code sign the project
Code signing is optional, but recommended.
Code signing assures users that the app is from a trustworthy developer, and hasn't been altered by someone else. In App Center, it's needed to distribute the app to users. Learn more from the Apple Developer Documentation.
Open
.xcworkspace
from the sample app's folder.Go to General within the
.xcworkspace
file.Under Identity, edit the Bundle Identifier to match the app ID.
Import and select the provisioning profile under Signing (Debug) and Signing (Release).
Add, commit, and push changes to your forked repository. It can be done from the terminal, or a tool of your choice.
You're all set up to try out an App Center service. Not sure what to do next? Most people build their app next; check out the Build Tutorial for a short walkthrough.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for