Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit afc7140

Browse files
Maxmaxim-pop
authored andcommitted
Improved logic to show error msg dependent on debug/release config (#811)
* Improved logic for ensureIfBundleExist method to show different message for debug/release configurations * fixed missing ;
1 parent ec35fa9 commit afc7140

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

ios/CodePush/CodePush.m

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,21 +329,25 @@ + (void)ensureBinaryBundleExists
329329
if (![self binaryBundleURL]) {
330330
NSString *errorMessage;
331331

332-
#if TARGET_IPHONE_SIMULATOR
333-
errorMessage = @"React Native doesn't generate your app's JS bundle by default when deploying to the simulator. "
334-
"If you'd like to test CodePush using the simulator, you can do one of three things depending on your React "
335-
"Native version and/or preferred workflow:\n\n"
336-
337-
"1. Update your AppDelegate.m file to load the JS bundle from the packager instead of from CodePush. "
338-
"You can still test your CodePush update experience using this workflow (debug builds only).\n\n"
339-
340-
"2. Force the JS bundle to be generated in simulator builds by removing the if block that echoes "
341-
"\"Skipping bundling for Simulator platform\" in the \"node_modules/react-native/packager/react-native-xcode.sh\" file.\n\n"
342-
343-
"3. Deploy a release build to the simulator, which unlike debug builds, will generate the JS bundle (React Native >=0.22.0 only).";
344-
#else
345-
errorMessage = [NSString stringWithFormat:@"The specified JS bundle file wasn't found within the app's binary. Is \"%@\" the correct file name?", [bundleResourceName stringByAppendingPathExtension:bundleResourceExtension]];
346-
#endif
332+
#ifdef DEBUG
333+
#if TARGET_IPHONE_SIMULATOR
334+
errorMessage = @"React Native doesn't generate your app's JS bundle by default when deploying to the simulator. "
335+
"If you'd like to test CodePush using the simulator, you can do one of three things depending on your React "
336+
"Native version and/or preferred workflow:\n\n"
337+
338+
"1. Update your AppDelegate.m file to load the JS bundle from the packager instead of from CodePush. "
339+
"You can still test your CodePush update experience using this workflow (debug builds only).\n\n"
340+
341+
"2. Force the JS bundle to be generated in simulator builds by removing the if block that echoes "
342+
"\"Skipping bundling for Simulator platform\" in the \"node_modules/react-native/packager/react-native-xcode.sh\" file.\n\n"
343+
344+
"3. Deploy a release build to the simulator, which unlike debug builds, will generate the JS bundle (React Native >=0.22.0 only).";
345+
#else
346+
errorMessage = [NSString stringWithFormat:@"The specified JS bundle file wasn't found within the app's binary. Is \"%@\" the correct file name?", [bundleResourceName stringByAppendingPathExtension:bundleResourceExtension]];
347+
#endif
348+
#else
349+
errorMessage = @"Something went wrong. Please verify if generated JS bundle is correct. ";
350+
#endif
347351

348352
RCTFatal([CodePushErrorUtils errorWithMessage:errorMessage]);
349353
}
@@ -583,7 +587,7 @@ - (void)applicationWillResignActive
583587
// Save the current time so that when the app is later
584588
// resumed, we can detect how long it was in the background.
585589
_lastResignedDate = [NSDate date];
586-
590+
587591
if (_installMode == CodePushInstallModeOnNextSuspend && [[self class] isPendingUpdate:nil]) {
588592
_appSuspendTimer = [NSTimer scheduledTimerWithTimeInterval:_minimumBackgroundDuration
589593
target:self

0 commit comments

Comments
 (0)