Skip to content

Commit 1271a02

Browse files
committed
Resolve expo 54 and react native 0.82.0 conflict
1 parent ef3529f commit 1271a02

File tree

6 files changed

+426
-12
lines changed

6 files changed

+426
-12
lines changed

IOS_BUILD_INSTRUCTIONS.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# iOS Build Instructions
2+
3+
## Summary
4+
This project uses React Native 0.82.0 with Expo modules to support the `@playerdata/react-native-mcu-manager` library. A compatibility patch has been applied to fix iOS build errors.
5+
6+
## Prerequisites
7+
- macOS with Xcode installed
8+
- CocoaPods installed (`sudo gem install cocoapods`)
9+
- Node.js 20+ installed
10+
11+
## Build Steps
12+
13+
### 1. Install Dependencies
14+
```bash
15+
npm install
16+
```
17+
18+
The `postinstall` script will automatically apply the expo-modules-core iOS compatibility patch.
19+
20+
### 2. Install iOS Pods
21+
```bash
22+
cd ios
23+
pod install
24+
cd ..
25+
```
26+
27+
### 3. Build for iOS
28+
```bash
29+
npm run ios
30+
```
31+
32+
Or open in Xcode:
33+
```bash
34+
open ios/IotDfu.xcworkspace
35+
```
36+
37+
## What Was Fixed
38+
39+
### Problem
40+
The error `No member named 'CallInvoker' in namespace 'facebook::react'` occurred because:
41+
- Expo SDK 54 (`expo-modules-core@3.0.24`) was designed for React Native 0.81
42+
- React Native 0.82 changed the location of the `CallInvoker` class on iOS
43+
44+
### Solution
45+
Applied a patch to add missing imports in two files:
46+
1. `node_modules/expo-modules-core/ios/JSI/EXJSIUtils.h`
47+
2. `node_modules/expo-modules-core/ios/JSI/EXJavaScriptRuntime.h`
48+
49+
Both files now include:
50+
```objc
51+
#import <ReactCommon/CallInvoker.h>
52+
```
53+
54+
### Patch Details
55+
- The patch is located in `patches/` directory
56+
- Automatically applied via `postinstall` script in `package.json`
57+
- Can be manually applied:
58+
- macOS/Linux: `bash patches/expo-modules-core-fix.sh`
59+
- Windows: `patches\expo-modules-core-fix.bat`
60+
61+
## Configuration Files
62+
63+
### iOS Files Modified for Expo Modules:
64+
65+
1. **ios/Podfile**
66+
- Added Expo autolinking script
67+
- Added `use_expo_modules!` in target block
68+
69+
2. **ios/IotDfu/AppDelegate.swift**
70+
- Added `import ExpoModulesCore`
71+
- Added `extraModules(for:)` method to register Expo modules
72+
73+
### Android Files Modified for Expo Modules:
74+
75+
1. **android/settings.gradle**
76+
- Added Expo autolinking configuration
77+
78+
2. **android/app/build.gradle**
79+
- Configured for Expo modules
80+
81+
3. **android/app/src/main/java/com/iotdfu/MainApplication.kt**
82+
- Integrated `ApplicationLifecycleDispatcher` for Expo modules
83+
84+
## Status
85+
86+
**Android Build**: Working perfectly with React Native 0.82 + Expo SDK 54
87+
**iOS Build**: Patch applied, needs testing on macOS
88+
89+
## Testing the App
90+
91+
Once the iOS build succeeds, test the following:
92+
1. App launches without "Cannot read property 'EventEmitter' of undefined" error
93+
2. BLE scanning works
94+
3. MCU Manager firmware update functionality works
95+
4. Device connection and communication work as expected
96+
97+
## Troubleshooting
98+
99+
### If iOS build still fails:
100+
1. Clean the build:
101+
```bash
102+
cd ios
103+
rm -rf Pods Podfile.lock
104+
pod install
105+
cd ..
106+
```
107+
108+
2. Clean Xcode build folder:
109+
- Open Xcode
110+
- Product → Clean Build Folder (Shift+Cmd+K)
111+
112+
3. Verify the patch was applied:
113+
```bash
114+
grep "ReactCommon/CallInvoker.h" node_modules/expo-modules-core/ios/JSI/EXJSIUtils.h
115+
grep "ReactCommon/CallInvoker.h" node_modules/expo-modules-core/ios/JSI/EXJavaScriptRuntime.h
116+
```
117+
Both commands should return a line showing the import.
118+
119+
### If you need to reapply the patch:
120+
```bash
121+
bash patches/expo-modules-core-fix.sh
122+
```
123+
124+
## Future Considerations
125+
126+
This patch is a temporary workaround. When Expo SDK 55 is released with official React Native 0.82 support, you can:
127+
1. Update to Expo SDK 55
128+
2. Remove the patch files and postinstall script
129+
3. Update dependencies
130+
131+
## Additional Notes
132+
133+
- The Android build is fully working and tested
134+
- The iOS configuration is complete and should work once built on macOS
135+
- Both platforms use the same Expo modules integration
136+
- The MCU Manager library requires Expo modules - there is no way to use it without Expo
137+

0 commit comments

Comments
 (0)