Skip to content

Commit f400656

Browse files
Merge pull request #902 from Iterable/feature/SDK-743-xcode-27-example-app
fix(SDK-743): run the example app on Xcode 27
2 parents f8b647c + bf1d762 commit f400656

6 files changed

Lines changed: 261 additions & 193 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Iterable's React Native SDK relies on:
5555
```ruby
5656
use_frameworks! :linkage => :dynamic
5757
```
58+
- **Xcode 27:** `run-ios` needs `@react-native-community/cli` **20.2.0+** so it opens Device Hub (`DeviceHub.app`) instead of `Simulator.app`. `xcode-select` must point at the Xcode you are using when more than one version is installed. Xcode 27 also refuses CocoaPods resource-bundle targets below iOS **15.0** (this SDK's `IterableSDKResources` bundle still inherits **12.0** from Iterable-iOS-SDK, including **6.7.5** pinned by RN **3.2.0**). Lift generated Pods targets to **15.1** in the app `Podfile` `post_install` — see this repo's `example/ios/Podfile`. That is a **host** workaround until Iterable's iOS SDK publishes a ≥ 15.1 minimum and this SDK depends on it. It does not change the published Iterable iOS support range.
5859
5960
- **Android**
6061
- [`minSdkVersion` 21+, `compileSdkVersion` 31+](https://medium.com/androiddevelopers/picking-your-compilesdkversion-minsdkversion-targetsdkversion-a098a0341ebd)

‎example/README.md‎

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,15 @@ React Native application.
1111
>"Creating a new application" step, before proceeding.
1212

1313
## Step 1: Install dependencies
14-
To install the app dependencies, run the following command from the
15-
_example app directory_ (the directory in which this document resides):
1614

17-
```bash
18-
yarn install
19-
```
20-
21-
Once this is done, you will need to install the pods in the _ios_ folder in the
22-
_example app directory_. To do so, run the following:
15+
From the **SDK repo root** (the parent of this `example/` directory):
2316

2417
```bash
25-
cd ios
26-
bundle install
27-
bundle exec pod install
18+
yarn install
19+
(cd example/ios && bundle install && bundle exec pod install)
2820
```
2921

30-
Once this is done, `cd` back into the _example app directory_:
31-
32-
```bash
33-
cd ..
34-
```
22+
`yarn install` at the root installs the Yarn workspace (SDK + example). The `example/ios` step is **iOS only** — skip it if you are only running Android.
3523

3624
## Step 2: Add your environment variables
3725
In the _example app directory_, there is a file called **.env.example**. Make a
@@ -69,36 +57,26 @@ To add an API key, do the following:
6957
6. Copy the generated API key and JWT secret into your _.env_ file
7058

7159

72-
## Step 3: Start the Metro Server
60+
## Step 3: Start your Application
7361

74-
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
75-
76-
To start Metro, run the following command from the _example app directory_:
62+
From the **SDK repo root**, run one of:
7763

7864
```bash
79-
yarn start
65+
yarn example android
8066
```
8167

82-
## Step 4: Start your Application
83-
84-
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _example app directory_. Run the following command to start your _Android_ or _iOS_ app:
85-
86-
### For Android
87-
8868
```bash
89-
yarn android
69+
yarn example ios
9070
```
9171

92-
### For iOS
72+
`run-android` / `run-ios` start **Metro** in a separate terminal by default. You do not need to run `yarn start` first. Pass `--no-packager` if you already have Metro running and do not want a second window.
9373

94-
```bash
95-
yarn ios
96-
```
74+
On **Xcode 27**, the CLI opens **Device Hub** (`DeviceHub.app`) instead of Simulator. This example pins `@react-native-community/cli` **20.2.0+** for that path. If several Xcode versions are installed, `xcode-select -p` must point at the one you intend to use.
9775

9876
**NOTE**: If you are getting an error when running ios, make sure that *Xcode > Project Navigator > ReactNativeSdkExample > Build Settings > User
9977
Script Sandboxing* is set to **No**
10078

101-
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
79+
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or on iOS (Simulator on Xcode 26 and earlier, Device Hub on Xcode 27) shortly provided you have set up your emulator/simulator correctly.
10280

10381
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
10482

@@ -218,6 +196,12 @@ gem install xcodeproj -v '< 1.26.0'
218196
gem install concurrent-ruby -v '< 1.3.4'
219197
```
220198

199+
## Xcode 27
200+
201+
Xcode 27 replaces `Simulator.app` with Device Hub. `yarn ios` / `yarn example ios` require `@react-native-community/cli` **20.2.0+** (this example already pins it). A `Simulator.app does not exist` error means an older CLI is still on the path, or `xcode-select` points at a different Xcode.
202+
203+
Xcode 27's iOS SDK also rejects any target with `IPHONEOS_DEPLOYMENT_TARGET` below **15.0**, including CocoaPods resource bundles such as `Iterable-iOS-SDK-IterableSDKResources` (12.0 from Iterable-iOS-SDK, including **6.7.5** pinned by RN **3.2.0**). This example's `ios/Podfile` `post_install` lifts generated Pods targets to **15.1**. Copy that lift into a host app Podfile if you hit the same `xcodebuild` 65 error. It does not change Iterable-iOS-SDK's published minimum; that wait is a later iOS SDK release that raises the platform to ≥ 15.1.
204+
221205
## Xcode 16.3 Issue
222206

223207
There is a [known issue](https://github.com/facebook/react-native/issues/50411)

‎example/ios/Podfile‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,22 @@ target 'ReactNativeSdkExample' do
3434
)
3535

3636

37-
## Temporary workaround for Xcode 26.4
37+
# Temporary workaround for Xcode 26.x / 27.
38+
# fmt 11.0.2 fails consteval checks under Apple Clang 21; compile fmt as C++17 only.
39+
# All other pods stay in C++20 (React-perflogger needs std::unordered_map::contains).
40+
# Xcode 27 rejects Pods resource-bundle targets below iOS 15.0 (e.g.
41+
# Iterable-iOS-SDK-IterableSDKResources at 12.0). Lift those generated targets
42+
# to RN's min; do not change published podspec support ranges.
3843
installer.pods_project.targets.each do |target|
3944
target.build_configurations.each do |config|
40-
# fmt/base.h unconditionally redefines FMT_USE_CONSTEVAL based on __cplusplus,
41-
# so preprocessor defines are overwritten. The reliable fix is to compile fmt
42-
# in C++17 mode: FMT_CPLUSPLUS (201703L) < 201709L → FMT_USE_CONSTEVAL = 0.
43-
# All other pods stay in C++20 (React-perflogger needs std::unordered_map::contains).
4445
if target.name == 'fmt'
4546
config.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++17'
4647
end
4748

49+
current = config.build_settings['IPHONEOS_DEPLOYMENT_TARGET']
50+
if current.nil? || current.to_f < 15.1
51+
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '15.1'
52+
end
4853
end
4954
end
5055
end

‎example/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
"@babel/core": "^7.25.2",
2626
"@babel/preset-env": "^7.25.3",
2727
"@babel/runtime": "^7.25.0",
28-
"@react-native-community/cli": "20.1.0",
29-
"@react-native-community/cli-platform-android": "20.1.0",
30-
"@react-native-community/cli-platform-ios": "20.1.0",
28+
"@react-native-community/cli": "20.2.0",
29+
"@react-native-community/cli-platform-android": "20.2.0",
30+
"@react-native-community/cli-platform-ios": "20.2.0",
3131
"@react-native/babel-preset": "0.85.3",
3232
"@react-native/eslint-config": "0.85.3",
3333
"@react-native/jest-preset": "0.85.3",

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"devDependencies": {
7272
"@commitlint/config-conventional": "^19.6.0",
7373
"@evilmartians/lefthook": "^1.5.0",
74-
"@react-native-community/cli": "20.1.0",
74+
"@react-native-community/cli": "20.2.0",
7575
"@react-native/babel-preset": "0.85.3",
7676
"@react-native/eslint-config": "0.85.3",
7777
"@react-native/jest-preset": "0.85.3",

0 commit comments

Comments
 (0)