Build iOS from source
Install Xcode
Before proceeding, you must first set up your local iOS development environment. This involves installing Xcode on a computer running macOS.
Note: Please use the latest non-beta version of Xcode.
With your local development environment ready follow the below steps to download and build your Median app.
Download iOS Source
Download the iOS Source code from your app's private management page by opening the "Build & Download" tab and clicking the “Download Source” button under iOS as seen in Figure 1:
![Figure 1](png/77e0e23-1_ios_source_download.png)
Figure 1
Extract the ios_source.tar.gz file and open
Extract the downloaded ios_source.tar.gz
file and open your app using one of the following methods.
- Double click the
ios_source.tar.gz
file within the MacOS Finder application to extract the archive. Once extracted, open the new subdirectory and double click<yourapp>.xcworkspace
. - Open a terminal session and run the command
tar -xzvf ios_source.tar.gz
. Once extracted, enter the subdirectory and runopen <yourapp>.xcworkspace
.
Open .xcworkspace not .xcodeproj
Median uses Cocoapods (or "pods") as a dependency package manager, and therefore you must open the workspace file
<yourapp>.xcworkspace
and not the project file<yourapp>.xcodeproj
.
Using terminal command
The
tar
command in method #2 will extract the file to a subdirectory named “ios”. If there is an existing directory with the same name it will be overwritten.
![Figure 2](png/7478a19-2_ios_source_dir.png)
Figure 2
Build and run app in simulator
Select the simulator/device you would like to use to run your app and click the Run play icon as seen in Figure 3. Xcode will start building your app and when complete it will be launched in the selected simulator/device.
![Figure 3](png/becc441-3_ios_source_xcode_build.png)
Figure 3
Cocoapods
All "pods" required by Median will be automatically installed into your iOS source by our online build platform. It is not necessary to run
pod install
or similar commands locally and these commands are not supported. If you need to install additional pods not supplied by Median please contact our support team for assistance.
Missing Files
If you are receiving errors about missing files, you should clean your build folder/derived data: https://stackoverflow.com/questions/38016143/how-can-i-delete-derived-data-in-xcode-8
Adding Capabilities
Some plugins such as push notifications require manually adding Capabilities within Xcode. For example, to add the Push Notifications capability in your app first select your app from the left panel of Xcode. Then in the right panel select “Signing & Capabilities” and click “+ Capability” as seen in Figure 4:
![Figure 4](png/3e5e43f-4_ios_source_xcode_capability.png)
Figure 4
Next, search and double click “Push Notifications” as seen in Figure 5:
![Figure 5](png/0923c29-5_ios_source_xcode_searchpush.png)
Figure 5
Once Xcode adds a Capability, it will be visible at the bottom of the “Signing and Capabilities” section as seen in Figure 6:
![Figure 6](png/ace3906-6_ios_source_xcode_pushadded.png)
Figure 6
Updated 1 day ago