Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: readme #208

Closed
tristangodfrey opened this issue Feb 24, 2016 · 2 comments
Closed

Question: readme #208

tristangodfrey opened this issue Feb 24, 2016 · 2 comments

Comments

@tristangodfrey
Copy link

Sorry for being nitpicky again!

The following part of the documentation:

Once your app has been configured and distributed to your users, and you've made some JS changes, it's time to release it to them instantly!

How do we get to the point of our app being configured if we have already set up CodePush?

If I follow the original react-native documentation it tells me to uncomment jsCodeLocation = [[NSBundle mainBundle] and then when I run the build it will write the JS bundle to my app somewhere.

If I've already configured CodePush on my app before ever building an offline bundle, will the behaviour be the same? Or should I manually place the bundle in my project?


So instead of just being lazy and posting the question I decided to test it out.

react-native: 0.20.0
react-native-code-push: ^1.7.3-beta

I've never compiled the app with a bundle, and build + running it in xCode resulted in the following:

(first set schema to production, then build + run)

  1. Packager automatically started
  2. Packager doesn't receive any requests
  3. App crashes: terminating with uncaught exception of type NSException

points to this loop:

// run the run loop
    while (kCFRunLoopRunStopped != CFRunLoopRunInMode(kCFRunLoopDefaultMode, ((NSDate *)[NSDate distantFuture]).timeIntervalSinceReferenceDate, NO)) {
      RCTAssert(NO, @"not reached assertion"); // runloop spun. that's bad.
    }

Not sure if this counts as a bug or not, but it might be convenient to allow usage of CodePush without having manually bundled, or having ran the original react-native code (jsCodeLocation = [[NSBundle mainBundle]) first.

I hope this makes sense and doesn't look too messy, beginner developer here.

@geof90
Copy link
Contributor

geof90 commented Feb 24, 2016

Hi @tristangodfrey,

The crash you are seeing is probably due to this issue facebook/react-native#5820. In RN 0.19+, there was a change added to the build script that skipped generating the offline bundle if you are running on the simulator. Therefore the app crashes because the offline bundle cannot be found. I think it has resulted in a lot of confusion in the RN community in general because it is not well documented anywhere. You should not be seeing this crash if you were to run on an actual device.

I recently sent out a PR to RN facebook/react-native#6119 to make the build script generate the offline bundle if the app is run in the "Release" mode. I hope it will get shipped as part of RN 0.21. If not the workaround for now, if you really need to test the offline build update scenario, is to comment out these lines facebook/react-native@5f0ef12 in node_modules/react-native/packager/react-native-xcode.sh

@tristangodfrey
Copy link
Author

Hi @geof90,

I actually looked at react-native-xcode.sh but just assumed it wasn't running at all. I think for now just linking the bundle files in my .xcodeproj manually works fine, don't really want to add any more exceptions to my .gitignore. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants