Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

react native - "Invariant Violation: Application AwesomeProject has not been registered" When building for iOS device with static jsbundle

First off, I don't know react, but I figured deploying to an iOS device instead of the simulator wouldn't be too difficult to do with the docs. They were a bit sparse but I got somewhere and now I'm stuck. I created a main.jsbundle and added it to the Xcode project and uncommented the line in AppDelegate.m.

When I deploy it I get this error:

2015-03-26 16:13:08.538 AwesomeProject[4753:2477032] >
  RCTJSLog> "Running application "AwesomeProject" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF"
2015-03-26 16:13:08.547 AwesomeProject[4753:2477032] >
  RCTJSLog> "Error: 
 stack: 
  runApplication                  main.jsbundle:33769
  jsCall                          main.jsbundle:7157
  _callFunction                   main.jsbundle:7404
  applyWithGuard                  main.jsbundle:877
  guardReturn                     main.jsbundle:7206
  callFunctionReturnFlushedQueue  main.jsbundle:7413
 URL: file:///private/var/mobile/Containers/Bundle/Application/DBC0DAF4-B568-4CF5-B156-9EFEE4E7FF4A/AwesomeProject.app/main.jsbundle
 line: 1536
 message: Invariant Violation: Application AwesomeProject has not been registered."
2015-03-26 16:13:08.723 AwesomeProject[4753:2477032] >
  RCTJSLog> "#CLOWNTOWN (error while displaying error): Network request failed"
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I'm pretty sure @krazyeom's fix has nothing to do with this error. In my case, I fixed this by quitting the terminal that was running from a previous test app I had run. It seems the terminal was confused and was still hooked to a process whose project was no longer loaded in XCode. Try the following:

  1. Shut the Terminal spawned by React Native.
  2. Shut down XCode completely (may not be necessary).
  3. Re-open everything and re-run.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...