Skip to content

chore: add and ignore ip.txt in ios#705

Merged
chinesedfan merged 2 commits intogitpoint:masterfrom
machour:ignore-ip.txt
Mar 29, 2018
Merged

chore: add and ignore ip.txt in ios#705
chinesedfan merged 2 commits intogitpoint:masterfrom
machour:ignore-ip.txt

Conversation

@machour
Copy link
Copy Markdown
Member

@machour machour commented Jan 29, 2018

Description

This one have been making me crazy since day 1: I never was able to run the app on ios simulator without hardcoding my IP in AppDelegate.m like this:

- jsCodeLocation = [[RCTBundleURLProvider jsBundleURLForBundleRoot:@ sharedSettings] "index.ios" fallbackResource:nil];
+ jsCodeLocation = [NSURL URLWithString:@"http://192.168.1.183:8081/index.ios.bundle"];

I discovered today that you can provide a file named ip.txt in Xcode and put the IP there instead:
https://github.com/facebook/react-native/blob/master/React/Base/RCTBundleURLProvider.m#L86

This PR add this empty file to Xcode and to gitignore at the same time, so you are free to put any IP there if needed.

I still need someone with a working setup without hardening the IP to give this a go.

(And git status will finally output nothing for me, and I won't have to google how to revert a commit when I commit my AppDelegate.m file by mistake 😭)

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 44.074% when pulling 32f8396 on machour:ignore-ip.txt into 2111d74 on gitpoint:master.

@chinesedfan
Copy link
Copy Markdown
Member

@machour After reading related codes of RN, I think this file is generated automatically. RN will try to detect the ip and save into ip.txt.

@machour
Copy link
Copy Markdown
Member Author

machour commented Jan 29, 2018

@chinesedfan yup, but this was never generated for me :/ writing it manually fix this hassle for me

@chinesedfan
Copy link
Copy Markdown
Member

@machour Hmm, that's weird. I can run the app easily on my iPhone 6Plus. I just need:

  • clone the repo and open by Xcode 9.2
  • change the bundle identifier and select my personal sign, as well as RN tutorial says
  • build and run

@machour
Copy link
Copy Markdown
Member Author

machour commented Feb 2, 2018

change the bundle identifier and select my personal sign, as well as RN tutorial says

can you give me a link to read? also, won't changing the bundle id generate modifications that shouldn't be commited?

@chinesedfan
Copy link
Copy Markdown
Member

Sorry, the tutorial is not an official document and is written by Chinese. And yes, don't commit these modifications. I also left some messages for you in Gitter. Hope you can find the root reason.

@machour
Copy link
Copy Markdown
Member Author

machour commented Feb 14, 2018

@chinesedfan I tried a lot of things over the past few days, the only thing that allows me to have a clean working copy (nothing to avoid commiting) is this PR.

Any blockers on your side to merge this in?

@chinesedfan
Copy link
Copy Markdown
Member

@machour I am not sure. Because I didn't face this problem.

@gitpoint/maintainers What about you guys think?

@machour
Copy link
Copy Markdown
Member Author

machour commented Feb 15, 2018

@chinesedfan, I meant, if you apply this PR locally and try to run the project as you usually do, does it still work for you?

@chinesedfan
Copy link
Copy Markdown
Member

@machour No problem. I can both work normally.

@chinesedfan
Copy link
Copy Markdown
Member

chinesedfan commented Mar 29, 2018

Really magic localhost for @machour. /etc/hosts is correct and ping localhost points to 127.0.0.1. Following links are able to be visited when running the simulator,

Except this,

Let me merge it to save him. And revert in one day we found the real reason.

@chinesedfan chinesedfan merged commit 9b63417 into gitpoint:master Mar 29, 2018
@machour
Copy link
Copy Markdown
Member Author

machour commented Mar 29, 2018

Thank you!!!! 😭 ❤️

@machour machour deleted the ignore-ip.txt branch March 29, 2018 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants