-
Benoit Lavenier authoredBenoit Lavenier authored
Build Cesium for iOS
Cesium can be build as desktop application for iOS. .
Prerequisites
Install an OSx VM
Cesium comes with ready to use Vagrantfile
, used to start a OSx VM easily.
-
Install VirtualBox
-
Install Vagrant
-
Make sure Cesium-desktop has been checkout inside the path
/platforms/desktop/
(or anywhere else). This should have been done, if you followed the installation steps. -
On a terminal, go inside platforms/desktop/arch/osx/, then start the VM:
cd platforms/desktop/arch/osx/
vagrant up --provision
- Connect to the VM:
vagrant ssh
- Execute the build
./build-osx.sh
This should download Cesium sources in Downloads/cesium_src
and binaries web artifact in Downloads/cesium
.
Installing XCode 8 (XIP file)
-
Download Xcode (8.2.1) : https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_8.2.1/Xcode_8.2.1.xip
-
Copy the
.xip
file into directoryplatforms/desktop/arch/osx/
-
Make sure to restart the VM (this is required to copy the XIP file)
vagrant halt
vagrant up
vagrant ssh
- Unpack the XIP file
unxip Xcode*.xip
- Install Xcode into
/Applications
, then configure xcode-select
sudo mv Xcode.app /Applications
- Configure
xcode-select
:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Install Node JS
- Install NVM (node.js version manager) :
- Install node.js 16
- Install common node.js dependencies
# NVM (Node version manager
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
# Node.js
nvm install 16
# node-pre-gyp
npm install -g nw-gyp node-pre-gyp
Build from source
-
Checkout Cesium source, from git, inside the directory
/Users/vagrant/Downloads/cesium_src
-
Install global dependencies (see Development Guide for versions to used) :
npm install -g yarn gulp cordova @ionic/cli@6.20.9
- Install project dependencies :
cd cesium_src
npm install
- Prepare ionic, to build on ios:
ionic platform add ios
ionic state reset
- Run cesium:
ionic run ios
- Build binaries for emulator :
ionic build ios
Publishing to Apple store
Pre-requisite
Ensure you have a valid Certificate (with your private key) and Distribution Provisioning Profile associated to it in the OSX Keychain.
See: https://help.apple.com/developer-account/#/devbfa00fef7
Archive and upload to Apple Store Connect
- Prepare for iOS in release mode:
ionic prepare ios --release --prod
- Generate archive for iOS generic device
cd platforms/ios
mkdir build
xcodebuild -workspace Cesium.xcworkspace -scheme Cesium -sdk iphoneos -configuration AppStoreDistribution archive -archivePath $PWD/build/Cesium.xcarchive
- Create an
export.plist
file with the following content
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>YOUR_TEAM_ID</string>
</dict>
</plist>
Replace YOUR_TEAM_ID
by the Team ID associated to your Apple Developer Account (see Membership section on https://developer.apple.com/account/)
- generate IPA for Apple Store
xcodebuild -exportArchive -archivePath $PWD/build/Cesium.xcarchive -exportOptionsPlist $PWD/export.plist -exportPath $PWD/build
- Upload to Apple Store Connect:
/Applications/Xcode.app/Contents/Applications/Application\ Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool --upload-app -f $PWD/build/Cesium.ipa -u YOUR_APPLE_ID
The command will prompt for your password, if you use two-factor authentication, you'll need to generate an application specific password for this command (see: https://appleid.apple.com/account/manage)
- Go to
https://appstoreconnect.apple.com/
, thenMy Apps
and publish your App from there.