Skip to content

Commit 8068309

Browse files
authored
chore: add things to try for common build issues (#114)
1 parent f43bc31 commit 8068309

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

docs/Troubleshooting.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Troubleshooting
2+
3+
## [iOS] CocoaPods issues
4+
5+
1. Delete the `node_modules` folder(s) from your project
6+
2. Run `yarn` or `npm install`
7+
3. If you're using CocoaPods:
8+
1. Make sure your `Podfile` has this entry:
9+
```Podfile
10+
pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/sync-storage'
11+
```
12+
2. Make sure your `Podfile` does _not_ have an entry for `react-native-async-storage`.
13+
3. `pod install`
14+
4. `pod update RNCAsyncStorage`
15+
4. Open your Xcode project
16+
5. Press ⇧⌥⌘K to clean your build folder
17+
6. Build and run your project
18+
19+
> Note that every time `@react-native-community/async-storage` gets updated, you
20+
> must also run `pod update RNCAsyncStorage` otherwise you'll still be using the
21+
> previous version.
22+
23+
## [iOS] fatal error: 'React/RCTBridgeModule.h' file not found
24+
25+
```
26+
info In file included from /~/@react-native-community/async-storage/ios/RNCAsyncStorage.m:8:
27+
/~/@react-native-community/async-storage/ios/RNCAsyncStorage.h:8:9: fatal error: 'React/RCTBridgeModule.h' file not found
28+
29+
info #import <React/RCTBridgeModule.h>
30+
^~~~~~~~~~~~~~~~~~~~~~~~~
31+
32+
info 1 error generated.
33+
```
34+
35+
- Make sure that you've run `pod install` or `pod update RNCAsyncStorage` (see
36+
also [CocoaPods issues](#ios-cocoapods-issues)).
37+
38+
- If you've manually linked React Native, but use CocoaPods for AsyncStorage,
39+
AsyncStorage will not be able to find React headers. You'll need to set header
40+
search path, or also consume React Native via CocoaPods.
41+
42+
- Make sure that `React` dependencies are _not_ removed from projects. Without
43+
the target dependency set, Xcode may build things out of order and the React
44+
headers will not be installed when AsyncStorage is built.
45+
46+
```Podfile
47+
post_install do |installer|
48+
installer.pods_project.targets.each do |target|
49+
if target.name == "React"
50+
target.remove_from_project
51+
end
52+
end
53+
end
54+
```
55+
56+
- Try switching back to the legacy build system in Xcode. You can find it in
57+
File > Project/Workspace Settings sheet.
58+
59+
## [@RNC/AsyncStorage]: NativeModule: AsyncStorage is null
60+
61+
### iOS
62+
63+
This error means that AsyncStorage was unable to find its native module. This
64+
occurs because AsyncStorage was not linked into the final app bundle.
65+
66+
- Make sure that you've run `pod install` or `pod update RNCAsyncStorage` (see
67+
also [CocoaPods issues](#ios-cocoapods-issues)).
68+
69+
- If you have an Expo app, AsyncStorage will not work unless you eject the app.
70+
After ejecting the app, you may have to
71+
[manually link](Linking.md#project-linking) depending on whether you chose to
72+
use Expo SDK.

0 commit comments

Comments
 (0)