I am creating a React Native iOS app, NOT using Expo. I installed AsyncStorage #react-native-async-storage/async-storage and am using it in my app as illustrated in the code below.
The problem is that I am getting the below error message. I have tried to fix the problem by taking the following steps, however the error persists. Can anyone advise how to fix the error?
My code:
import AsyncStorage from '#react-native-async-storage/async-storage'
const authenticate = (token) => {
setAuthToken(token)
AsyncStorage.setItem('token', token)
}
Steps I've taken to resolve error (all unsuccessful):
quit the terminal and simulator, then rebuilt and restarted app
ran npm start --reset-cache
navigated to ios directory and ran pod install
The error message:
ERROR Error: [#RNC/AsyncStorage]: NativeModule: AsyncStorage is null.
To fix this issue try these steps:
• Rebuild and restart the app.
• Run the packager with `--reset-cache` flag.
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app.
• If this happens while testing with Jest, check out docs how to integrate AsyncStorage with it: https://react-native-async-storage.github.io/async-storage/docs/advanced/jest
This error usually occurs when the library was not linked correctly or if auto-linking is not working. Try linking the library manually as explained here.
react-native link #react-native-async-storage/async-storage
Related
Hello Folks,
When I try to run my project either in xcode or in Android studio in iOS 16.1 device then it says like "error: 'Flutter/Flutter.h' file not found" and "error: failed to emit precompiled header ios/Runner/Runner-Bridging-Header.h".
Following are my current details:
MacOS: 13.0.1 Ventura
Flutter: 3.3.8
Dart: 2.18.4
Android Studion Chipmunk
If anyone have any valid solution to this issue which actually works then it will be very helpful.
Thanks.
I did try following solutions:
https://stackoverflow.com/questions/64973346/error-flutter-flutter-h-file-not-found-when-flutter-run-on-ios
Tried deleting ios flutter and regenerate it.
Tried Flutter clean, pub get, cd ios, pod install, pod update but nothing worked.
Unable to get Xcode project information:
2022-12-01 13:57:05.376 xcodebuild[71564:226197] Writing error result bundle to
/var/folders/6g/w7cqd0s54c33_20mrl4v2q640000gn/T/ResultBundle_2022-01-12_13-57-0005.xcresult
xcodebuild: error: Unable to read project 'Runner.xcodeproj'.
Reason: Project /Users/noel/Treegar/treegar-app/ios/Runner.xcodeproj cannot be opened because it is missing its
project.pbxproj file.
i keep getting this error when ever i run flutter run or flutter build ios.
i dont know what to do... it works fine on android but not on ios.
ive updated xcode and flutter same problem
flutter doctor -v
UPdate cocoapod to latest version
update flutter
update xcode
This error message indicates that the Runner.xcodeproj file is missing or cannot be opened.
This file is part of the Xcode project for your Flutter app and is necessary for building and running the app on iOS.
To fix this issue, try the following steps:
Make sure that you have the latest version of Xcode installed on
your computer. You can check for updates and download the latest
version of Xcode from the Mac App Store.
Make sure that you have the latest version of the Flutter SDK
installed on your computer. You can update Flutter by running the
flutter upgrade command in a terminal window.
Make sure that you have the latest version of CocoaPods installed on
your computer. You can update CocoaPods by running the
sudo gem
install -n /usr/local/bin cocoapods
command in a terminal window.
Make sure that you have a valid Xcode project file for your Flutter
app. If the Runner.xcodeproj file is missing, you can try running
the flutter create . command in the root directory of your Flutter
app to recreate the Xcode project files.
If the above steps do not help, you can try deleting the ios directory in your Flutter app and running the flutter create . command again to recreate the Xcode project files from scratch.
After trying these steps, try running the flutter run or flutter build ios command again to see if the issue has been resolved. If you continue to encounter errors, please provide more information about the specific steps you are taking and the full error message you are seeing.
try flutter clear and pubget.
or
try pod install
or
if it is not harmfull for your code try to delete ios folder and recreate it
in your project. may be this can work .
I'm receiving the following error when trying to run my React Native app for iOS on Xcode: "'React/RCTMockDef.h' file not found". I'm on React Native v0.67.2 and I've already tried doing cd ios and pod install. Can anyone help? Thanks
I'm trying to archive my iOS app which works fine when I build for debugging via xcode but when I try to archive the app I get the following errors which I'm not sure what's causing it
I think the real reason for failure would be a little above in the listing, which cannot be seen here.
I had similar kind of issue when updated react native to version 0.54.2 the iOS archive stopped working.
My error message was something like:
A problem occurred while trying to fetch the minifier. Path: "metro-minify-uglify" Cannot find module 'uglify-es'
And the problem was that my react native project only had uglify-js in node-modules (I quess that the new react native needed the uglify-es). So I installed that with:
npm install uglify-es --save
And after that I did (not sure if these are needed) xCode->clean project, shutdown xCode, delete Library->Developer->Xcode->DerivedData, restart Xcode and archive started working again.
I am trying to get up and running with react native.
I have xcode and watchmen installed as required in this link.
https://facebook.github.io/react-native/docs/getting-started.html
Following the quickstart I have done the below
npm install -g react-native-cli
react-native init AwesomeProject
In the newly created folder AwesomeProject/
Open AwesomeProject.xcodeproj and hit run in Xcode.
When I do this I get the 'red error screen' in my iphone emulator with the below message.
'undefined' has no propType for native prop 'RCTMap.mapType' of native type 'MKMapType'
I have had a look at the troubleshooting link but have not been able to identify this as a known error.
How can this be resolved?
I think this happens when the xcode packager stops working correctly. How I fix it:
Stop xcode
Close the terminal running packager
Clean solution
Click Build and Run (play button)