diff --git a/docs/architecture.md b/docs/architecture.md index 35ff9256576..0ffe555834b 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -49,7 +49,7 @@ persisted data. In general most of the work will be inside of the `/src` directory. The only reason to touch the `/ios` or `/android` directories would be to add native -modules (which we aren't using at the moment). +modules. ### Top-level files * `package.json` - specifies `yarn` / NPM dependencies and scripts for the project diff --git a/docs/howto/build-run.md b/docs/howto/build-run.md index ce11c890f77..12543bb760a 100644 --- a/docs/howto/build-run.md +++ b/docs/howto/build-run.md @@ -74,12 +74,18 @@ Native upstream on You want the tab "React Native CLI Quickstart"; the "Expo CLI Quickstart" does not apply. -If you're starting with iOS development, be sure to install CocoaPods, -as the guide instructs. After you've done that, run -`cd ios && pod install && cd ..`. +If you're starting with iOS development, be sure to [install +CocoaPods](https://guides.cocoapods.org/using/getting-started.html), +as the guide instructs, then rerun `yarn`. Continue those instructions until you can run the Zulip Mobile app -with either `react-native run-android` or `react-native run-ios`. +with one of the following: + +- `react-native run-android` +- `react-native run-ios` +- in Xcode, if on macOS (see [iOS tips](ios-tips.md)) +- in Android Studio (see "Android tips", below) + You'll want to be able to use both an emulator and a physical device; but for starting out, just get either one working so you can play with the app. @@ -499,3 +505,9 @@ Optionally, reset iOS simulator: ``` iOS Menu > Simulator > Reset Content and Settingsā€¦ ``` + +If you get other iOS build failures and you haven't changed anything +in the `ios` folder yourself, and you're on the latest version of +Xcode, there might be residue from a previous build interfering in +this one. So, try cleaning the build folder, following the +instructions at [iOS tips](ios-tips.md#clearing-the-build-folder) diff --git a/docs/howto/ios-tips.md b/docs/howto/ios-tips.md index 14930dacc75..85f32505561 100644 --- a/docs/howto/ios-tips.md +++ b/docs/howto/ios-tips.md @@ -13,9 +13,6 @@ this tab. ## Other commands -* `cd ios && pod install && cd ..` - if you've already run `yarn`, - installs native iOS dependencies to match the Podfile.lock - * `yarn ios-min` - runs in an iOS simulator in the minimally supported device (currently iPhone 5S) @@ -27,7 +24,9 @@ device name in package.json ## Running on an iOS device 1. Connect your iOS device -2. Within the repo, `$ open ios/ZulipMobile.xcworkspace/` to open Xcode +2. Within the repo, `$ open ios/ZulipMobile.xcworkspace/` to open + Xcode. Make sure you choose the one that ends in .xcworkspace, + not .xcodeproj. 3. Change BundleIdentifier for both ZulipMobile and ZulipMobileTests to a unique string, e.g. `ZulipMobile` in the 'General Tab' of your project. 4. Select your device as the `build target` (from [this guide](https://facebook.github.io/react-native/docs/running-on-device.html)) @@ -58,3 +57,18 @@ unstaged. Later, you can always [squash that commit with other commits][fixing-commits], if appropriate. [fixing-commits]: https://zulip.readthedocs.io/en/latest/git/fixing-commits.html + +## Clearing the build folder + +If you get build failures on iOS and you haven't changed anything in +the `ios` folder yourself, and you're on the latest version of Xcode, +there might be residue from a previous build interfering with this +one. So, try cleaning the build folder with `rm -rf`. A different +folder is used for command-line builds and builds through Xcode. +- If building from the command line with `react-native run-ios`, run + `rm -rf ios/build`. +- If building in Xcode, the build folder is at a path like + `~/Library/Developer/Xcode/DerivedData/ZulipMobile-diuocloqwafvdpeozujwphdrhalf` + (the hash at the end will be different) by default, but if it's not + there, you can find it in Xcode at File > Workspace Settings > Build + Location. diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 08c80b0e444..a316d807e41 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,7 +1,7 @@ PODS: - boost-for-react-native (1.63.0) - DoubleConversion (1.1.6) - - EXApplication (2.1.0): + - EXApplication (2.1.1): - UMCore - EXAppLoaderProvider (7.0.0) - EXConstants (7.0.1): @@ -292,7 +292,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c DoubleConversion: bb338842f62ab1d708ceb63ec3d999f0f3d98ecd - EXApplication: 777c2f1742b381725b3e8c1da41f0113ebfd4694 + EXApplication: 7cf81de6fafccff42f5d1caa5c24a159db6b9437 EXAppLoaderProvider: 5d348813a9cf09b03bbe5b8b55437bc1bfbddbd1 EXConstants: 857aa7b1c84e2878f8402d712061860bca16a697 EXFileSystem: 7e53a2c30a2eb6987ba6d5158ab908f947523228 diff --git a/package.json b/package.json index 3174f900bf7..96943b58ac6 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.0", "private": true, "scripts": { + "postinstall": "tools/postinstall", "start": "react-native start", "ios": "react-native run-ios", "ios-min": "react-native run-ios --simulator 'iPhone 5s'", @@ -34,13 +35,14 @@ "@react-native-community/async-storage": "^1.6.3", "@react-native-community/netinfo": "^3.2.1", "@sentry/react-native": "^1.0.9", + "@unimodules/core": "~4.0.0", "@zulip/shared": "^0.0.2", "base-64": "^0.1.0", "blueimp-md5": "^2.10.0", "color": "^3.0.0", "date-fns": "^1.29.0", + "expo-application": "^2.1.1", "katex": "^0.11.1", - "expo-application": "^2.1.0", "lodash.escape": "^4.0.1", "lodash.isequal": "^4.4.0", "lodash.omit": "^4.5.0", diff --git a/tools/ios b/tools/ios index 0711582cc3d..29f555ef2da 100755 --- a/tools/ios +++ b/tools/ios @@ -41,7 +41,6 @@ archive_path="${rootdir}"/ios/build/ZulipMobile.xcarchive do_build() { yarn - pod install echo >&2 mkdir -p build diff --git a/tools/postinstall b/tools/postinstall old mode 100644 new mode 100755 index e69de29bb2d..0e92cf16682 --- a/tools/postinstall +++ b/tools/postinstall @@ -0,0 +1,26 @@ +#!/bin/bash +set -eu + +ROOT_DIR=$(git rev-parse --show-toplevel) + +pod_install() { + [[ "$OSTYPE" == "darwin"* ]] \ + || return 0 + + if ! hash pod 2>/dev/null; then + cat >&2 <