-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Run on device for iOS? (RN .29) #8850
Comments
@natdm since you've changed AppDelegate.m you need to rebuild your project and reload the app |
@rturk I thought that's what happens when I had react-native update all my files. Is it not? It updated AppDelegate.m and it looks similar to a new project I'd init and vastly different than my .26 version. |
Just tried the same thing on a new project and it still failed - so there's probably a different way than the docs describe to package .29 to the device. |
Hey @natdm, can you give me the details on how is your network being setup? The new AppDelegate.m should be able to detect your IP address automatically. |
It's nothing different than it was before I upgraded, but it's possible that would explain my other issue - I can't make a network call within the app if I run the app on the cell without trying to bundle the JS file to the phone. I can get to 192.168.0.13:3000/wherever in Safari on my device, but I can't make the call within my app now that I upgraded - failed network call. It will work in the emulator though, when everything is set to localhost. This doesn't work no matter what network I'm on - been to three locations, all 3 used to work before this. Not sure what to give you on my network settings. The phone and mac are both on the same network and can reach each other outside of the application. The app has a socketed connection that works fine, but not anything else. Again, this all worked perfectly before the upgrade. |
Can you try to access 192.168.0.13.xip.io:3000 from your phone? We added the xip.io workaround to circumvent the App Transport Security limitation. |
I'm currently at work so my network location has changed. I can get to 172.xx.xx.xx.xip.io:3000 in the browser though. I can't get to it from the app on the phone. Console error:
|
And here is the authLogin function calling the console.error() (line 74 is the console error call):
And the loginAuth function:
And authorize:
|
And I can make all my API calls in iPhone Safari with xip.io on my device. Here's how I store my locations. Does this have anything to do with how it's breaking?
|
How is the login network request being setup? Do you just specify an IP address or do you have a domain name? |
I'm only working with the URL's I pasted above - all IP's and I change them depending on what location I'm at. |
Ah, sorry, I didn't read your last comment. #5355 changed the ATS settings from In addition to this, since Apple's ATS settings doesn't allow numerical IP address, you'll need to have some workaround for it. We do that for the packager by using https://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ |
Well that did it - for now I just disabled it. I went through all the changes from .26 to .29.1 and seemed to have missed this. RN is changing so fast. Thank you so much for your help, @nathanajah ! |
@nathanajah - How would I package on the device? |
What do you mean by "package on the device"? |
I mean if I leave the AppDelegate.m the way it is, build through XCode to my device, the packager is running on my macbook. If I close the packager, the app dies. How do I create a production-ready package for the app in .29? |
Have you tried running the app without the packager running? |
I had remote debugging turned on. Works great without it.. apparently I've missed a lot. Thanks again @nathanajah |
Great! Maybe we can look into how to provide a better error message or automatically disable remote debugging on bundle. |
Would be a good idea. I had to take a look at the RCTWebSocketExecutor.m to figure out what was going on. Small hiccup. |
Running on a device for iOS on .29 seems to be different than where I was at (.26).
On .29, the AppDelegate.m file is vastly different than it was. there's no comments explaining what to do for dev or production.
Docs say:
Open ios/YourApp/AppDelegate.m
Uncomment the line, jsCodeLocation = [[NSBundle mainBundle] ...
My AppDelegate.m has a jsCodeLocation but not [[NSBundle mainBundle] ...
`#import "AppDelegate.h"
import "RCTBundleURLProvider.h"
import "RCTRootView.h"
@implementation AppDelegate
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
[[RCTBundleURLProvider sharedSettings] setDefaults];
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"BidSmart"
initialProperties:nil
launchOptions:launchOptions];
rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
@end`
When I comment out the jsCodeLocation variable in my AppDelegate.m, I get "Unable to execute JS call: __fbBatchedBridge is undefined" on the app - but it builds successfully.
The text was updated successfully, but these errors were encountered: