When trying to build ios client in react-native, I modified part of AppDelegate.m file as shown below (i.e., replaced option 1 with option 2):
// OPTION 1
// Load from development server. Start the server from the repository root:
//
// $ npm start
//
// To run on device, change `localhost` to the IP address of your computer, and make sure your computer and
// iOS device are on the same Wi-Fi network.
//jsCodeLocation = [NSURL URLWithString:#"http://localhost:8081/index.ios.bundle"];
// OPTION 2
// Load from pre-bundled file on disk. To re-generate the static bundle, run
//
// $ curl http://localhost:8081/index.ios.bundle -o main.jsbundle
//
// and uncomment the next following line
jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
I downloaded main.jsbundle to the iOS folder where AppDelegate.m is.
$ ls iOS
AppDelegate.h Base.lproj Info.plist main.m
AppDelegate.m Images.xcassets main.jsbundle
But, if I do the build again in XCode and run it in ios simulator, it pauses in main.m with the following error:
2015-03-31 12:46:28.877 AwesomeProject[26849:1320518] * Assertion
failure in -[RCTRootView initWithBundleURL:moduleName:launchOptions:],
/Users/yourname/scripts/code/startup/reactnative/AwesomeProject/node_modules/react-native/React/Base/RCTRootView.m:82
2015-03-31 12:46:28.883 AwesomeProject[26849:1320518] * Terminating
app due to uncaught exception 'NSInternalInconsistencyException',
reason: 'A bundleURL is required to create an RCTRootView'
So, it seems to be complaining about bundleURL. I will appreciate help with identifying what the issue is.
You need to add the file to the project.
To do so, you need to right-click on the project name and select "Add files to MyProject…". Then choose the main.jsbundle.
Then build your project and it should work.
See: How to build React Native App for iPhone?
Related
I'm on a big problem in my actual project. Everytime when I try to run iOS simulator this error appear in my log. I tried chance Xcode version, delete all pods, change zshrc file, but nothing happens.
Anyone to help? If I create a new project and run npx react-native run-ios works to me but on this specific project dont run anything.
Infos:
RN Version: 0.64.0
oS infos: Macbook Air M1 big Surr
Node version: v14.0
Follow the error:
objc[24913]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1edc1bbc8) and /System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x118130318). One of the two will be used. Which one is undefined.
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/viniciusachterberg/Library/Developer/Xcode/DerivedData/AgrinessPresence-aatyymmaxydmoqfhtgtytzoqepin/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-48ABC94909B35DCD398CB750635A0D8D.sh
(1 failure)```
Using Netbeans 11.3. Create the project from https://start.codenameone.com/. copy the contents of the tools/netbeans directory into the root project directory. I can run the project simulator, run the project simulator in debug mode fine. When I build the project to send to the CN1 build server it fails and I get a long Error Log. The first lines of the log are: -
Found hyp.beamId
Tried to start hyperlog but failed: Failed to start hyperlog: Cannot run program "hyp":
error=2, No such file or directory
User-level: 9000
Request Args:
-----------------
hyp.beamId=98214081-18fb-4b78-963b-b4bd363fe576
java.version=8
maven.codenameone-maven-plugin=7.0.58
ios.newStorageLocation=true
maven.codenameone-core.version=LATEST
https://www.dropbox.com/s/seldwwr75ex3wpa/error%20%2810%29.txt?dl=0
I am building an android apk via 'Send Android build' and it shows that the build is successful. When I go to check the build server, it shows that it's empty.. Apparently with no build.
This is output in my console:
ant -f /home/falcon/NetBeansProjects/bizapp_mobile build-for-android-device
Generating GUI sources
No GUI Entries available
init:
deps-clean:
Updating property file: /home/falcon/NetBeansProjects/bizapp_mobile/build/built-clean.properties
Deleting directory /home/falcon/NetBeansProjects/bizapp_mobile/build
refresh-libs-impl:
Deleting directory /home/falcon/NetBeansProjects/bizapp_mobile/lib/impl
Deleting directory /home/falcon/NetBeansProjects/bizapp_mobile/native/internal_tmp
clean:
copy-android-override:
Created dir: /home/falcon/NetBeansProjects/bizapp_mobile/build/classes
copy-libs:
Copying 12 files to /home/falcon/NetBeansProjects/bizapp_mobile/build/classes
deps-jar:
Updating property file: /home/falcon/NetBeansProjects/bizapp_mobile/build/built-jar.properties
JavaFX Not loaded. Classpath=/home/falcon/.codenameone/designer_1.jar . Adding to classpath
Adding JavaFX to your project properties file at nbproject/project.properties
JavaFX should be correctly loaded the next time you run this project.
Restarting JVM with JavaFX in the classpath.
NOTE: If you are trying to debug the project, you'll need to cancel this run and try running debug on the project again. JavaFX should now be in your classpath.
JavaFX is loaded
Retina Scale: 1.0
Updating merge file /home/falcon/NetBeansProjects/bizapp_mobile/css/theme.css.merged
Input: /home/falcon/NetBeansProjects/bizapp_mobile/css/theme.css
Output: /home/falcon/NetBeansProjects/bizapp_mobile/src/theme.res
Acquiring lock on CSS checksums file /home/falcon/NetBeansProjects/bizapp_mobile/.cn1_css_checksums...
Lock obtained
File has not changed since last compile.
Releasing lock
CSS file successfully compiled. /home/falcon/NetBeansProjects/bizapp_mobile/src/theme.res
Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller
code size and wider device support
Created dir: /home/falcon/NetBeansProjects/bizapp_mobile/build/tmp
Compiling 42 source files to /home/falcon/NetBeansProjects/bizapp_mobile/build/tmp
Created dir: /home/falcon/NetBeansProjects/bizapp_mobile/build/empty
Created dir: /home/falcon/NetBeansProjects/bizapp_mobile/build/generated-sources/ap-source-output
Compiling 42 source files to /home/falcon/NetBeansProjects/bizapp_mobile/build/classes
warning: [options] bootstrap class path not set in conjunction with -source 8
1 warning
Copying 2 files to /home/falcon/NetBeansProjects/bizapp_mobile/build/classes
compile:
Created dir: /home/falcon/NetBeansProjects/bizapp_mobile/dist
Copying 1 file to /home/falcon/NetBeansProjects/bizapp_mobile/build
Not copying library /home/falcon/NetBeansProjects/bizapp_mobile/override , it's a directory.
Not copying library /home/falcon/NetBeansProjects/bizapp_mobile/lib/impl/cls , it's a directory.
Not copying library /home/falcon/NetBeansProjects/bizapp_mobile/lib/impl/stubs , it's a directory.
Not copying library /home/falcon/NetBeansProjects/bizapp_mobile/${cn1.javafx.path} , it can't be read.
Not copying library /home/falcon/NetBeansProjects/bizapp_mobile/native/internal_tmp , it can't be read.
Copy libraries to /home/falcon/NetBeansProjects/bizapp_mobile/dist/lib.
Building jar: /home/falcon/NetBeansProjects/bizapp_mobile/dist/BizApp.jar
To run this application from the command line without Ant, try:
java -jar "/home/falcon/NetBeansProjects/bizapp_mobile/dist/BizApp.jar"
Created dir: /home/falcon/NetBeansProjects/bizapp_mobile/native/internal_tmp
jar:
clean-override:
build-for-android-device:
BUILD SUCCESSFUL (total time: 11 seconds)
Where could I be going wrong?
EDIT
Now this is confusing...
When I ran 'Send Android build' when my PC is connected to internet, it gives that message I posted before.
So accidentally, I ran 'Send Android build' while my PC was offline and it passed that point and it showed me this pop up:
Now.. once I this pop-up shows, that's when I connect to internet and everything will flow as supposed to.
So its like, if I have internet connected right from the start, it isn't successful but if I connect to internet after showing me the popup of an invalid Android certificate, everything will work fine and the build will be in the build server.
But is causing this now?
I'm getting this following error after I ran my app on my own ios device.
No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT, no such file or directory '/Users/cauealmeida/Library/Logs/CoreSimulator/5C6DA43E-3993-4260-87EE-73FEB27DE181/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/build/emulator/map-test.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/console.log,--stdout,/Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/console.log,--exit
Error: /Users/cauealmeida/Documents/jobs/dev/ionic-maptest/map-test/platforms/ios/cordova/run: Command failed with exit code 2
I've tried with ionic emulate ios -cls from different projects and the same error is shown.
What am I missing?
Here are the steps you can use to correct this issue:
1) Empty the 'platforms' folder in your Ionic project
2) Re-run ionic platform add ios, ionic build ios, and ionic emulate ios without sudo
3) Still getting a permissions error, make sure all the files in your user's home folder actually belong to that user by running
sudo chown -R username /Users/username
We fixed this using the SO answer here, which was just to Reset Content and Settings in the Simulator menu.
You need to download ios simulator.
Go to xcode and download ios 9 or other simulator.
you also need to install ios-sim using your terminal.
sudo npm install -g ios-sim
also check and confirmed your device is connected properly.
connected device you see in xcode window
Run the react-native bundle command in terminal from the root
directory of your app
What is the root directory of my app? I am trying to run UIExplorer (on my device) from the official repo but its always giving me this message when I run
react-native bundle
Command bundle unrecognized.Did you mean to run this inside a react-native project?
I think I tried pretty much every directory inside /react-native-master
You don't need to run react-native bundle.
You should follow the 'OPTION 2' instruction in AppDelegate.m, you will find something like the screenshots below:
The instruction in the React-native website is not so clear, a clearer instructions will be:
Open iOS/AppDelegate.m
Comment out jsCodeLocation = [NSURL
URLWithString:#"http://localhost:8081/index.ios.bundle"];
Uncomment jsCodeLocation = [[NSBundle mainBundle]
URLForResource:#"main" withExtension:#"jsbundle"];
Run the curl given in 'OPTION 2' (e.g.
http://localhost:8081/index.ios.bundle -o main.jsbundle)
if this fails add the --ipv4 flag to the end of it.
In XCode, right click on your project directory and click Add
Files to "Project Name Here" - choose the main.jsbundle file that
you generated.
Referenced from: https://github.com/facebook/react-native/issues/240
If you still can't run it, check your main.jsbundle if it contains error. If it does, make sure the given curl path is correct. I end up changing the curl to curl http://localhost:8081/Examples/UIExplorer/UIExplorerApp.ios.bundle -o main.jsbundle in order for it to work.
open cmd go project dir and run git bash show Command bundle unrecognized. bat cmd does not show an error