{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/8789","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/8789/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/8789/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/8789/events","html_url":"https://github.com/facebook/react-native/pull/8789","id":165648550,"number":8789,"title":"Improve fragile configuration of iOS devices for testing","user":{"login":"david135","id":8586431,"avatar_url":"https://avatars.githubusercontent.com/u/8586431?v=3","gravatar_id":"","url":"https://api.github.com/users/david135","html_url":"https://github.com/david135","followers_url":"https://api.github.com/users/david135/followers","following_url":"https://api.github.com/users/david135/following{/other_user}","gists_url":"https://api.github.com/users/david135/gists{/gist_id}","starred_url":"https://api.github.com/users/david135/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david135/subscriptions","organizations_url":"https://api.github.com/users/david135/orgs","repos_url":"https://api.github.com/users/david135/repos","events_url":"https://api.github.com/users/david135/events{/privacy}","received_events_url":"https://api.github.com/users/david135/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react-native/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7"},{"url":"https://api.github.com/repos/facebook/react-native/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-07-14T20:14:56Z","updated_at":"2016-07-15T17:06:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/8789","html_url":"https://github.com/facebook/react-native/pull/8789","diff_url":"https://github.com/facebook/react-native/pull/8789.diff","patch_url":"https://github.com/facebook/react-native/pull/8789.patch"},"body":"** motivation**\r\nMake the configuration for testing the app less brittle, give clearer error messages, and automatically do the right thing when possible.  The goal is to work out of the box in more circumstances than the current setup.\r\n\r\nThe current system fails in a number of cases to configure properly for testing on a physical iOS device:\r\n   1) It defaulted to the ethernet IP address (en0), while many developers could be using their wi-fi address (as would the iOS device). It now attempts to use the wi-fi IP address (en1) first, falling back to the ethernet IP address (en0).  NOTE: you could reverse the priority if defaulting to en0 is desired.\r\n   2) It used the 'xip.io' domain to get around App Transport Security's restriction on giving exceptions to numeric IP addresses.  It now warns if the xip.io domain is not resolvable (as in the case where one's router performs DNS Rebinding Protection). NOTE: it is possible that we should fail and exit if this is the case, but perhaps the iOS device can resolve the name even though the computer cannot (this could be the case if the iOS device and the computer use different DNS).\r\n  3) It now adds 'localhost' as an exception for App Transport Security to Info.plist when building for the iphonesimulator.\r\n  4) It notifies the developer that it is adding exceptions to Info.plist, both for the iphonesimulator and for physical iOS devices. Note that possibly there is no need to add the 'localhost' exception in the case of configuring for a physical iOS device.  I did not remove it, to keep changes as local as possible.\r\n\r\n1) and 2) may both allow developers to get started in testing on a physical iOS device instead of being stuck with difficult-to-understand errors or silent failures.  3) is helpful for developers testing on the iPhone simulator. 4) is important for letting the developer know that security settings have been altered.\r\n\r\nThanks for your consideration, and for any suggestions.\r\n\r\n** Test plan **\r\nCreate a new React Native App:\r\nreact-native init Testing\r\nedit the file:  Testing/node_modules/react-native/packager/react-native-xcode.sh\r\n\r\nEnsure that Testing/ios/Testing/Info.plist has no NSAppTransportSecurity entry.\r\n\r\nin Xcode:\r\nBuild a test app for the iphone simulator and run/update on the iphone simulator. (success)\r\n(set up provisioning for testing with a physical iPhone [an iphone 6 running iOS 9.3], set location of node binary)\r\nBuild a test app while connected via wi-fi only and run/update on an iPhone. (success)\r\nBuild a test app while connected via ethernet only and run/update on an iPhone. (success)\r\nBuild a test app while connected via wifi and ethernet and run/update on an iPhone. (success, defaults properly to wi-fi)\r\nBuild a test app with DNS Rebinding Protection in place and run/update on an iPhone. (warns, iOS device can load if it avoids DNS Rebinding Protection)\r\nIn each of these cases, the app loads and re-loads from the development server.\r\nIn each of these cases, the NSAppTransportSecurity entries are added for the first build (or after the source \"Info.plist\" file is modified), and confirmed in subsequent builds.\r\nBuild a test app with no valid IP. (fails with explanation)"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/233009792","html_url":"https://github.com/facebook/react-native/pull/8789#issuecomment-233009792","issue_url":"https://api.github.com/repos/facebook/react-native/issues/8789","id":233009792,"user":{"login":"david135","id":8586431,"avatar_url":"https://avatars.githubusercontent.com/u/8586431?v=3","gravatar_id":"","url":"https://api.github.com/users/david135","html_url":"https://github.com/david135","followers_url":"https://api.github.com/users/david135/followers","following_url":"https://api.github.com/users/david135/following{/other_user}","gists_url":"https://api.github.com/users/david135/gists{/gist_id}","starred_url":"https://api.github.com/users/david135/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david135/subscriptions","organizations_url":"https://api.github.com/users/david135/orgs","repos_url":"https://api.github.com/users/david135/repos","events_url":"https://api.github.com/users/david135/events{/privacy}","received_events_url":"https://api.github.com/users/david135/received_events","type":"User","site_admin":false},"created_at":"2016-07-15T17:06:40Z","updated_at":"2016-07-15T17:06:40Z","body":"The attached image is the result in the simulator if built without the localhost exception in Info.plist.  I see the options as:\r\n1) Add the exception, notifying the developer that this has been done.\r\n2) Give an error and exit, with the build failing.\r\n3) Give a warning, but allow the build to succeed.\r\n4) Allow the build to succeed.\r\n\r\nMy original submission does (1), which I think is most developer-friendly. I think (2) may be more technically correct, allowing the developer to do what they want, but does have a potential downside of leaving code in the developer's source which is unnecessary for the release version. I think (3) may be less helpful than we could be, since the simulator will immediately fail, and (4) is simply confusing.\r\n\r\nPreferences between (1), (2), and (3)? I see no benefit to (4)."}}
{"actor":{"display_login":"david135"}}