ios Could not get BatchedBridge, make sure your bundle is packaged properly - ios

I am getting this while running app on simulator using xCode, version 9.2
I've tried other solution mentioned on Stack overflow & Github S1S2 S3 S4 but most of the solution are mentioned for android.
P.S. This project also includes purescript code explained here Integrate Pure Script in your React Native project

That's how I resolved it.
Terminate your metro bundler > react-native link > react-native run-ios
It was not bundling because of some errors which was not showing in the simulator but just this error was thrown.

create index.js, index.android.js and index.ios.js whith the same content. I do have all of them and it solved my issue

I have also faced the same issue when I changed the name of images saved in my local directory. In my case, I have just restarted metro bundler, deleted the app, and restarted the app. Issue was fixed for me.

Try this:
npx react-native-asset
then:
react-native run-ios

This issue is caused basically when some packages or images are not bundled properly, it might be caused because of improper assets path or internet issue when installing packages or reload issue. The expo bundles into a standalone library so it can be available immediately.
This error does not provide any stack to debug since it does not properly have the bundled data even for error stack.
I have just face few bundled scenarios
Scenario 1 => While the expo is running and we install a new library on fly, few times during this importing the library might not get bundled properly, so it's better to stop the expo and re-run, or try reloading the error in app. This will some time resolve the issue, or if there is some error it will show up the error stack
Scenario 2 => You have a customised asset director or have changed the asset path in app.json file improperly.
Please let me know in comments if there are any other scenarios

I had a metro bundler terminal window opened and whenever I was running npm run ios , it wasn't starting a new metro server, the problem was that. I closed the metro bundler terminal window and ran npm run ios and it opened a started a new metro server and the error was gone

I had a same issue, then I did:
rm -rf node_modules,
npm install
and restarted the metro (npm start). It worked.

In Settings, go to Privacy > Local Network to see a list of every app that requested access. I solved by allowing my app to access to the local network. (Trying to run on physical iPhone device from my mac m1 on the same wifi).
Source

Make sure that when you restart the expo project you do so with expo start -c
-c throws out the cache, otherwise the problem persisted for me.

Related

Themeablebrowser/Themeablebrowser-wkwebview bring error during running ios .ipa

Due to the latest policy of app store, I need to remove the uiwebview and replace into wkwebview. I tried a lot of way and currently I stuck with the themeable browser. It seems like this plugin is the main problem as when I removed this, I achieved to upload it into the app store. Before this, my .ipa have been rejected eventually after I uploaded it in xcode. Then, (I don't know what is the cause or because of my multiple try and error experiment), the present of themeablebrowser bring error when I run the project on ipad or build it. While, before this my apps can run smoothly with it. This plugin is important for me to access another url.
Below are my code;
Uninstall & remove themeable browser
ionic cordova plugin rm cordova-plugin-themeablebrowser
npm uninstall #ionic-native/themeable-browser
Install and add themeablebrowser-wkwebview. Below are my codes and the error produced;
npm install cordova-plugin-themeablebrowser-wkwebview
cordova plugin add cordova-plugin-themeablebrowser-wkwebview
error archive failed - when running on ipad
I keep repeating the same process like removing the themeablebrowser-wkwebview plugin and add the themeablebrowser again, and get this
Is there any solution regarding this? Thank you.. 🙏

UMModuleRegistryAdapter.h not found when running React Native app in iOS simulator

I have a simple React Native app that I've been testing on Android and now want to test on iOS. It's using React Navigation.
I ran npm run ios but I'm getting the following error:
info In file included from
/Users/rbbit/reactnative/testproj1/ios/testproj1/main.m:10:
/Users/rbbit/reactnative/testproj1/ios/testproj1/AppDelegate.h:9:9: fatal error: 'UMReactNativeAdapter/UMModuleRegistryAdapter.h' file not found
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
info 1 error generated.
I opened XCode but I'm basically getting the same message, nothing else that would help me debug this.
I do see that there is a package called react-native-adapter (https://github.com/expo/expo/tree/master/packages/%40unimodules/react-native-adapter), however I'm hesitant to just install this since I followed the instructions on how to include react-navigation and didn't mention that, assuming this is related.
Also, that page says If you are using react-native-unimodules, this package will already be installed and configured!, and react-native-unimodules already is in my dependencies.
Any pointers on how to solve this? Thank you!
For latest RN versions (RN 0.60+) errors like this should be fixed with the auto-linking and just running a pod install.
For older versions you should try:
react-native link in the root folder of your project
Then in Xcode Product->Clean Build folder, restart JS server and attempt to rebuild.
If still not working double check the configs from here:
https://github.com/unimodules/react-native-unimodules
and the App.delegate from here:
https://gist.github.com/brentvatne/1ece8c32a3c5c9d0ac3a470460c65603
Sources:
Pod install reminder was first suggested by Sandy in the below comment
pod install didn't work for me until I added these lines to my pod file:
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
And
use_unimodules!(modules_paths: ['../node_modules'])
Then do a pod install.
Example: https://gist.github.com/sjchmiela/6c079f2173938a9a61a7c6f053c45000
I had this exact same error with everything configured correctly, everything in the other answers done and all the unimodules installation steps already done, on a project that had worked for months, building it on a new computer. It turned out the reason was because I was simply using the wrong file in xCode.
I had opened the .xcodeproj file when I should have opened and run the build from the .xcworkspace file.
Everything seemed to work as normal apart from this error, which made it look like a configuration problem rather than a simple "you opened the wrong file" problem. Hopefully if someone else makes the same mistake, this will save them a few hours of fruitless tinkering.

Requiring unknown module "498" error in ReactNative getting started example

I'm trying to build and run an iOS simulator version of the getting started React Native project from the instructions at:
https://facebook.github.io/react-native/docs/getting-started.html
The app launches in the XCode simulator, displays it's window very briefly but then an exception occurs that opens a red screen with the message
"Requiring unknown module "498".If you are sure the module is there,
try restarting Metro Bundler. You may also want to run yarn, or npm
install (depending on your environment).
loadModuleImplementation require.js:176:29
viewPropTypes.js:15:30
loadModuleImplementation require.js:212:12
View.js:20:22
loadModuleImplementation require.js:212:12
AppContainer.js:22:13"
etc
Line 15 of ViewPropTypes is
const PlatformViewPropTypes = require('PlatformViewPropTypes');
Line 20 of node_modules/react_native/Libraries/Components/Views/View.js is
const ViewPropTypes = require('ViewPropTypes');
Note: There is another, 15 line View.js files in the directory structure at node_modules/react_native/lib/ it's basically a stub containing
// This is a forwarding module to allow React to require React Native internals
// as node dependency
module.exports = require('View');
I'm on the latest of everything, MacOS High Sierra (10.13.4), XCode 9.3 with 9.3 command line tools installed. I've tried running yarn and npm install, and a fresh install. Obviously I have NPM and Watchman installed. Any ideas why the stock example won't run for me?
Newbie mistake. I had previously attempted to build a different React Native project in a different directory, and Metro Bundler was still pointed at the previous project. As the error message suggested, restarting Metro Bundler fixed the problem.
Also didn't realize the errors in the exception screen were tappable, they take you right into the Metro Bundler terminal process for more detail. Hope this helps someone else too!
In my case, just close all the related process, and re-run react-native run-android solved the problem.
refer to: https://github.com/facebook/react-native/issues/11568
I had the same issue.
In my case, while creating a reusable component, I wasn't importing React into the file,as I was not using them(in functional component) in the component file.
Turns out that jsx to React Element conversion happens per file/module basis, so we should import React and component in every file.
Including Both React and Component normally, solved the problem.
For me I got "955" error. And a simple solution was to
import React, {Component} from "react";

React-Native: Build error GeneratedInfoPlistDotEnv.h file not found

I had a old React-Native project which I wanted to give it a try again and when trying to run the project on iOS (Android works perfect) I get the error that Debug-iphonesimulator/GeneratedInfoPlistDotEnv.h file not found.
If I run the project from the command react-native run-ios, than the build will succeed.
What can cause this issue and how can it be fixed?
I have tried to fix it with the comments from this issue but no success.
React-Native verision: 0.47
Full error:
<built-in>:1:10: fatal error:
'/Users/myUser/Library/Developer/Xcode/DerivedData/Project-gcaxrvbcwgkfhkadevoqxcprxszw/Build/Products/Debug-iphonesimulator/GeneratedInfoPlistDotEnv.h' file not found
I fixed by copying file GeneratedInfoPlistDotEnv.h (in /ios/build/Build/Products/) to the path mentioned in the error message.
The path mentioned in error message for simulator is not same as real phone, you need to copy for a second time.
The development for React Native just like droped in a deep black hole, what you need to do is just climb and climb and climb...
Changing the Info.plist preprocessor prefix file to works for me ${CONFIGURATION_BUILD_DIR}/../GeneratedInfoPlistDotEnv.h
Image of code in Xcode 9
If you're coming from React version 0.60 and above, you should be referencing the package from GitHub instead of NPM. The author hasn't released auto-linking support on NPM yet, even though it's already merged!?
Try these steps after you unlink and uninstall the existing version of react-native-config. Remember to revert to default Info.plist preprocessor settings in XCode build settings.
yarn add https://github.com/luggit/react-native-config.git
cd ios && pod install
You don't have to add any other post-install scripts, just run the app like usual and it should work fine. Make sure you undo any other fixes before doing this.

Meteor cordova ios project pch errors

I've been working on a Meteor project using Cordova to build an iOS app. It was working very smoothly for a while and then all of a sudden I started getting this error:
❯❯❯ meteor run ios
Error while running for mobile platforms: Error running
/Users/chet/.meteor/packages/meteor-tool/.1.0.37.19du6bc++os.osx.x86_64+web.browser+web.cordova/meteor-tool-os.osx.x86_64/tools/cordova-scripts/cordova.sh
2014-12-23 13:35:00.970 xcodebuild[46060:3143193] error: InputFile /Users/chet/Code/meteor/5cmenu/.meteor/local/cordova-build/platforms/ios/5C Menu/5C
Menu-Prefix.pch 0 1418992636 959 33188... malformed line 9; 'InputFile' should have exactly five arguments
If I open the .xcodeproj in .meteor/local/cordova-build/platforms/ios/, the project runs just fine. However, its an old version of my meteor app.
I tried deleting .meteor/local, then meteor run ios. I get the same error. And when I opened the .xcodeproj, it worked when I tried running it.
I also tried meteor remove-platform ios then meteor add-platform ios. Then I ran meteor run ios. I get the same error, but again, when I opened the .xcodeproj, it worked.
Theres a similar [issue posted here](https://github.com/meteor/meteor/issues/3105
).
A couple things I've tried are deleting the Xcode DerivedData folder, and cleaning my Xcode build cache for the project by running cmd+shift+K which seems totally unnecessary for this problem.
I also found a similar issue here that said this is a "non-fatal error".
Any ideas how to fix this problem?
So one of the ways reset your Xcode build is with rm -rf .meteor/local/. Then meteor run ios-device will build a new project. However, when you do this, you end up with his PCH error because of some sort of caching.
You'll find a path in your error that looks something like this
/var/folders/x5/mdr8syvj7lsb_sg_pr0j7y_h0000gn/C/com.apple.DeveloperTools/6.1.1-6A2008a/Xcode/SharedPrecompiledHeaders/
Notice the SharedPrecompiledHeaders part. Delete the app that starts with your app name. Then do this all over
rm -rf .meteor/local/
meteor run ios-device
Works every time
You have a space in your path, which is being interpreted as another argument.
/Users/chet/Code/meteor/5cmenu/.meteor/local/cordova-build/platforms/ios/5C Menu/5C
More info here: https://github.com/meteor/meteor/issues/3105#issuecomment-75580362

Resources