Skip to content

Commit 74b34bd

Browse files
chore: improve example project and add iOS documentation (#76)
1 parent 701cb33 commit 74b34bd

13 files changed

Lines changed: 652 additions & 112 deletions

docs/IOS-EXAMPLE-WARN-en.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# iOS Example Project Running Notes
2+
3+
## Issue 1: iOS boost Dependency Installation Error
4+
5+
When installing iOS dependencies, you may encounter the following error:
6+
7+
![boost Installation Error](./images/IOS-EXAMPLE-WARN/error-installing-boost.png)
8+
9+
### Root Cause
10+
11+
This error occurs because CocoaPods performs SHA-256 verification on "downloaded local source code archives", and the result doesn't match the value declared in the podspec file, causing the installation to terminate directly.
12+
13+
### Solution
14+
15+
1. **Locate the podspec file**
16+
17+
From the log information, you can find the location of the boost podspec file:
18+
```
19+
example/node_modules/react-native/third-party-podspecs/boost.podspec
20+
```
21+
22+
![Fetching podspec file](./images/IOS-EXAMPLE-WARN/fetching-podspec-for-boost.png)
23+
24+
2. **View current configuration**
25+
26+
The content of this podspec file is as follows:
27+
28+
![boost podspec file content](./images/IOS-EXAMPLE-WARN/boost-podspec-before.png)
29+
30+
3. **Modify the download link**
31+
32+
Refer to [Error installing boost: Verification checksum was incorrect, expected](https://stackoverflow.com/questions/77738691/error-installing-boost-verification-checksum-was-incorrect-expected) to modify the link in the podspec file.
33+
34+
**Original link:**
35+
```bash
36+
https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2
37+
```
38+
39+
**Change to:**
40+
```bash
41+
https://archives.boost.io/release/1.76.0/source/boost_1_76_0.tar.bz2
42+
```
43+
44+
4. **Reinstall dependencies**
45+
46+
After modification, save the file and then go to the `example/ios` directory to execute:
47+
```bash
48+
pod install
49+
```
50+
51+
## Issue 2: iOS Example Startup Error
52+
53+
When executing `yarn example ios` from the root directory to run the example project on iOS simulator (or physical device), you may encounter the following error:
54+
55+
![iOS project build failure](./images/IOS-EXAMPLE-WARN/failed-to-build-ios-project.png)
56+
57+
### Root Cause
58+
59+
From the logs, the following error is found:
60+
61+
![functional template error](./images/IOS-EXAMPLE-WARN/no-template-named-functional-error.png)
62+
63+
### Solution
64+
65+
1. **Locate the problematic file**
66+
67+
Find the file in `example/ios`:
68+
```
69+
example/ios/Pods/Headers/Public/Flipper/FlipperTransportTypes.h
70+
```
71+
72+
2. **Add header file reference**
73+
74+
Add `#include <functional>` below `#include <string>`, as shown in the following image:
75+
76+
![Add functional header file](./images/IOS-EXAMPLE-WARN/include-functional-in-FlipperTransportTypes.png)
77+
78+
> **Reference**: [FlipperKit 'facebook::flipper::SocketCertificateProvider' (aka 'int') is not a function or function pointer template named 'function' in namespace std](https://stackoverflow.com/questions/78184461/flipperkit-facebookflippersocketcertificateprovider-aka-int-is-not-a-f)
79+
80+
3. **Rerun the project**
81+
82+
Then execute from the root directory again:
83+
```bash
84+
yarn example ios
85+
```
86+
87+
This will successfully run the example project on iOS simulator (or physical device).
88+
89+
## Reference Links
90+
91+
- [Error installing boost: Verification checksum was incorrect, expected](https://stackoverflow.com/questions/77738691/error-installing-boost-verification-checksum-was-incorrect-expected)
92+
- [FlipperKit 'facebook::flipper::SocketCertificateProvider' (aka 'int') is not a function or function pointer template named 'function' in namespace std](https://stackoverflow.com/questions/78184461/flipperkit-facebookflippersocketcertificateprovider-aka-int-is-not-a-f)

docs/IOS-EXAMPLE-WARN-zh.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# iOS 端 Example 项目运行注意事项
2+
3+
## 问题 1: iOS boost 依赖安装报错
4+
5+
在安装 iOS 依赖时,会遇到如下错误:
6+
7+
![boost 安装错误](./images/IOS-EXAMPLE-WARN/error-installing-boost.png)
8+
9+
### 问题原因
10+
11+
出现这个报错的原因是 CocoaPods 对"下载到本地的源代码压缩包"做了 SHA-256 校验,结果和 podspec 里声明的值对不上,于是直接终止。
12+
13+
### 解决方案
14+
15+
1. **定位 podspec 文件**
16+
17+
从日志信息中,可以找到 boost 的 podspec 文件的位置:
18+
```
19+
example/node_modules/react-native/third-party-podspecs/boost.podspec
20+
```
21+
22+
![获取 podspec 文件](./images/IOS-EXAMPLE-WARN/fetching-podspec-for-boost.png)
23+
24+
2. **查看当前配置**
25+
26+
这个 podspec 文件的内容如下:
27+
28+
![boost podspec 文件内容](./images/IOS-EXAMPLE-WARN/boost-podspec-before.png)
29+
30+
3. **修改下载链接**
31+
32+
参考 [Error installing boost: Verification checksum was incorrect, expected](https://stackoverflow.com/questions/77738691/error-installing-boost-verification-checksum-was-incorrect-expected),修改 podspec 文件里的链接。
33+
34+
**原链接:**
35+
```bash
36+
https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2
37+
```
38+
39+
**修改为:**
40+
```bash
41+
https://archives.boost.io/release/1.76.0/source/boost_1_76_0.tar.bz2
42+
```
43+
44+
4. **重新安装依赖**
45+
46+
修改后保存文件,然后重新到 `example/ios` 目录下执行:
47+
```bash
48+
pod install
49+
```
50+
51+
## 问题 2: iOS Example 启动错误
52+
53+
在根目录下执行 `yarn example ios` 在 iOS 模拟器(或真机)运行 example 项目会遇到报错:
54+
55+
![iOS 项目构建失败](./images/IOS-EXAMPLE-WARN/failed-to-build-ios-project.png)
56+
57+
### 问题原因
58+
59+
从日志中发现错误信息:
60+
61+
![functional 模板错误](./images/IOS-EXAMPLE-WARN/no-template-named-functional-error.png)
62+
63+
### 解决方案
64+
65+
1. **定位问题文件**
66+
67+
`example/ios` 下找到文件:
68+
```
69+
example/ios/Pods/Headers/Public/Flipper/FlipperTransportTypes.h
70+
```
71+
72+
2. **添加头文件引用**
73+
74+
`#include <string>` 下面添加上 `#include <functional>`,如下图所示:
75+
76+
![添加 functional 头文件](./images/IOS-EXAMPLE-WARN/include-functional-in-FlipperTransportTypes.png)
77+
78+
> **参考**: [FlipperKit 'facebook::flipper::SocketCertificateProvider' (aka 'int') is not a function or function pointer template named 'function' in namespace std](https://stackoverflow.com/questions/78184461/flipperkit-facebookflippersocketcertificateprovider-aka-int-is-not-a-f)
79+
80+
3. **重新运行项目**
81+
82+
然后重新在根目录下执行:
83+
```bash
84+
yarn example ios
85+
```
86+
87+
即可成功在 iOS 模拟器(或真机)运行 example 项目。
88+
89+
## 参考链接
90+
91+
- [Error installing boost: Verification checksum was incorrect, expected](https://stackoverflow.com/questions/77738691/error-installing-boost-verification-checksum-was-incorrect-expected)
92+
- [FlipperKit 'facebook::flipper::SocketCertificateProvider' (aka 'int') is not a function or function pointer template named 'function' in namespace std](https://stackoverflow.com/questions/78184461/flipperkit-facebookflippersocketcertificateprovider-aka-int-is-not-a-f)
99.3 KB
Loading
9.86 KB
Loading
26.9 KB
Loading
6.04 KB
Loading
74 KB
Loading
68.9 KB
Loading

example/ios/Podfile.lock

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ PODS:
7474
- hermes-engine/Pre-built (= 0.72.4)
7575
- hermes-engine/Pre-built (0.72.4)
7676
- libevent (2.1.12)
77-
- open-im-sdk-rn (3.8.3-patch.3):
78-
- "OpenIMSDKCore (= 3.8.3+3)"
77+
- open-im-sdk-rn (3.8.3-patch.10):
78+
- OpenIMSDKCore (= 3.8.3-hotfix.10)
7979
- React-Core
80-
- "OpenIMSDKCore (3.8.3+3)"
80+
- OpenIMSDKCore (3.8.3-hotfix.10)
8181
- OpenSSL-Universal (1.1.1100)
8282
- RCT-Folly (2021.07.22.00):
8383
- boost
@@ -667,7 +667,7 @@ EXTERNAL SOURCES:
667667
:path: "../node_modules/react-native/ReactCommon/yoga"
668668

669669
SPEC CHECKSUMS:
670-
boost: 57d2868c099736d80fcd648bf211b4431e51a558
670+
boost: 7dcd2de282d72e344012f7d6564d024930a6a440
671671
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
672672
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
673673
FBLazyVector: 5d4a3b7f411219a45a6d952f77d2c0a6c9989da5
@@ -684,30 +684,30 @@ SPEC CHECKSUMS:
684684
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
685685
hermes-engine: 81191603c4eaa01f5e4ae5737a9efcf64756c7b2
686686
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
687-
open-im-sdk-rn: 90243d9286a075a609c657c21b69e12c3d206692
688-
OpenIMSDKCore: 75caba22be8ee484011f367711178312bd64a17d
687+
open-im-sdk-rn: 79907bc234d57b81d3fbaed85a8fcb4ec6a3eb9b
688+
OpenIMSDKCore: bc9a6e5de2aabed76e4f69fe06a7c9df1d945afc
689689
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
690-
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
690+
RCT-Folly: 8dc08ca5a393b48b1c523ab6220dfdcc0fe000ad
691691
RCTRequired: c0569ecc035894e4a68baecb30fe6a7ea6e399f9
692692
RCTTypeSafety: e90354072c21236e0bcf1699011e39acd25fea2f
693693
React: a1be3c6dc0a6e949ccd3e659781aa47bbae1868f
694694
React-callinvoker: 1020b33f6cb1a1824f9ca2a86609fbce2a73c6ed
695-
React-Codegen: a0a26badf098d4a779acda922caf74f6ecabed28
696-
React-Core: 52075b80f10c26f62219d7b5d13d7d8089f027b3
697-
React-CoreModules: 21abab85d7ad9038ce2b1c33d39e3baaf7dc9244
698-
React-cxxreact: 4ad1cc861e32fb533dad6ff7a4ea25680fa1c994
695+
React-Codegen: 8f9a7e3dfc257094ec462e6ad1d4513fe5441600
696+
React-Core: 92372dd74aa4b6867a5d2c8ebb7a709662e58407
697+
React-CoreModules: b934bf2d99a27be649d5682b5057268b5df91928
698+
React-cxxreact: 59f5b1e71556ec2090efafa15059c2474814d89a
699699
React-debug: 17366a3d5c5d2f5fc04f09101a4af38cb42b54ae
700-
React-hermes: 37377d0a56aa0cf55c65248271866ce3268cde3f
701-
React-jsi: 6de8b0ccc6b765b58e4eee9ee38049dbeaf5c221
702-
React-jsiexecutor: c7f826e40fa9cab5d37cab6130b1af237332b594
700+
React-hermes: 90135a94ae1a7421156a1706f18a0a37657e9ea2
701+
React-jsi: fc410485e0dd09d222c37fcaa9eb7e2c85a49399
702+
React-jsiexecutor: bee9fca67c1b8ab7d9cf1c8e19a50968dc15ba2e
703703
React-jsinspector: aaed4cf551c4a1c98092436518c2d267b13a673f
704-
React-logger: da1ebe05ae06eb6db4b162202faeafac4b435e77
705-
React-NativeModulesApple: edb5ace14f73f4969df6e7b1f3e41bef0012740f
704+
React-logger: 005cf0fc175b43fd5a1abca9ad02fc50c5db45d3
705+
React-NativeModulesApple: 3020a249a8b7c7d7070a1666925e86e9d3f2773e
706706
React-perflogger: 496a1a3dc6737f964107cb3ddae7f9e265ddda58
707707
React-RCTActionSheet: 02904b932b50e680f4e26e7a686b33ebf7ef3c00
708708
React-RCTAnimation: 88feaf0a85648fb8fd497ce749829774910276d6
709-
React-RCTAppDelegate: 5792ac0f0feccb584765fdd7aa81ea320c4d9b0b
710-
React-RCTBlob: 0dbc9e2a13d241b37d46b53e54630cbad1f0e141
709+
React-RCTAppDelegate: 0cdc520f9eeb4335982736c29714cdfc9accc10a
710+
React-RCTBlob: 3ca099b9fbe7238deff53b31cc836adf463c9fb3
711711
React-RCTImage: b111645ab901f8e59fc68fbe31f5731bdbeef087
712712
React-RCTLinking: 3d719727b4c098aad3588aa3559361ee0579f5de
713713
React-RCTNetwork: b44d3580be05d74556ba4efbf53570f17e38f734
@@ -716,14 +716,14 @@ SPEC CHECKSUMS:
716716
React-RCTVibration: 691c67f3beaf1d084ceed5eb5c1dddd9afa8591e
717717
React-rncore: 142268f6c92e296dc079aadda3fade778562f9e4
718718
React-runtimeexecutor: d465ba0c47ef3ed8281143f59605cacc2244d5c7
719-
React-runtimescheduler: 4941cc1b3cf08b792fbf666342c9fc95f1969035
720-
React-utils: b79f2411931f9d3ea5781404dcbb2fa8a837e13a
721-
ReactCommon: 4b2bdcb50a3543e1c2b2849ad44533686610826d
722-
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
719+
React-runtimescheduler: 30a5fd3151996a8f2ad13d0b7df65337c36c1e40
720+
React-utils: 5af1d6c958748398eae8030a2fa08af220f4a2e6
721+
ReactCommon: 00926ccf1a9b03cc7cfbfb2b838591a0a1b754f1
722+
RNFS: 89de7d7f4c0f6bafa05343c578f61118c8282ed8
723723
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
724724
Yoga: 3efc43e0d48686ce2e8c60f99d4e6bd349aff981
725725
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
726726

727727
PODFILE CHECKSUM: 4dbe5b2292f0da6e9132a3324ff04d107cea44ac
728728

729-
COCOAPODS: 1.15.2
729+
COCOAPODS: 1.16.2

example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"pods": "pod-install --quiet"
1010
},
1111
"dependencies": {
12-
"open-im-sdk-rn": "^3.4.2",
1312
"react": "18.2.0",
1413
"react-native": "0.72.4",
1514
"react-native-fs": "^2.20.0"

0 commit comments

Comments
 (0)