Using ADB to run React Native on-device (iOS) - ios

In the React Native documentation (0.40) "Running on Device" for iOS on MacOS, it suggests using adb reverse to connect to the development server over USB. This method is, in fact, the recommended method.
I understand this works for Android, but I wasn't aware it would work for iOS devices. Whenever I try adb reverse tcp:8081 tcp:8081 as per the docs, it gives me error: no devices/emulators found.
After searching on Google for using adb with iOS/iPhone, I wasn't getting anything. I also didn't find anything on React Native's issues regarding it, and Stack Overflow's closest thread is related to debugging with adb, not running React Native (or iOS generally) through USB using adb.
Does anyone have any experience using this method successfully?

As mentioned in comment by jcaron, there was an issue in the doc, adb is Android specific.
A pull request was sent and accepted a few days ago.
The changes are already reflected in the next version: http://facebook.github.io/react-native/releases/next/docs/running-on-device.html

Related

ADB Shell equivalent for iOS device - Remote FireTV

I'm looking for a way to control an Amazon FireTV TV on an iOS device. I researched and found that most FireTVs are controlled by the Adb Shell method. But on iOS it is not supported. Is there any way to solve this problem? Thanks !
iOS does not support ADB. Nor does it have any similar debugging interface: Apple carefully avoids providing tools in that style.
Using the ish iOS app you can install adb as part of “apk add android-tools” then adb connect firestick-ip:5555.
Assuming you’ve already installed remote adb on Firestick.

Can you build a react-native iOS app using WINDOWS?

Can you build for iOS with react-native on Windows?
Or does it require xcode?
If so, any work arounds?
I dont want to work on a mac... or a mac vm.
I think the app you create with react-native will work with iOS but you might just have to develop it without an iOS SDK. (essentially, you can't really see the app in a virtual iOS device whilst developing).
However, i think if you develop the app for android using android studio SDK with react native, the app should also work with iOS as well. It's just that you won't really be able to see the app in development on a virtual iOS device.
Another option is to use expo when using react native. Essentially, it displays your app on your iphone so you can technically do app development whilst viewing the app on an iOS device, but I don't think its that great as you can only see it on your phone, whilst I prefer to use a virtual device on my laptop.
You can view documentation for expo in the react native docs here:
https://facebook.github.io/react-native/docs/getting-started
I'd recommend you to just develop the app for android using the android SDK from Android studio. This also works with expo or react native CLI. Although you may have to develop the app in a virtual android device, I think the app also works with an iOS device (it may just look a little bit different e.g. a button in android will look different to a button on iOS)
Here's a tutorial that really helped me with learning React-Native:
https://www.youtube.com/watch?v=NuZOwsmzcro
Just follow the steps and make sure you install an android SDK. Then once you get to around "9:25", instead of starting up an iOS emulator from an iOS SDK, start up the android one from android SDK, then hit the button "a" to choose android and you're all set!
The short answer is NO. iOS apps need to build on a Mac. However, if you have a cheap old Mac, or even a Mac cloud account, you can effectively do the equivalent while (almost) never touching the Mac. Of course, this assumes that it has been setup up once, and builds via Xcode or Xcode command line. Once that is done, you can automate it so that you're working and testing only on the PC.
For example, I once took over a React Native project where the previous developer did something similar. Because it was a generic interface, he coded on his PC, then tested via the Android emulator without ever testing for iOS. At that point you can simply push code to GitHub (manually, or with something like Fastlane or a user script). Separately, you have a script on that old Mac or online Mac-as-a-service that checks periodically and builds when the code changes. There were some times when the Mac needed special attention, but for the most part, it worked solely on one machine.
Namely, you can not run IOS Simulator on windows. But you can access a virtual IOS machine and run Simulator from windows virtually as a solution..

Is there any way to build IOS app on Windows?

I'm developing native apps but I have a Windows pc. Is there an actual way to build iOS apps on Windows? And can I run an ios emulator on Windows? I researched but I can't find an actual way.
I tried to install MacOS Sierra on Virtual Box but it consistently restarting.
Do I need both to build it?
NativeScript CLI & Sidekick support cloud build that would help you build your app from a Windows machine, basically the source code is uploaded to a remote machine and built there, then you could directly run the package on your local iOS device.
But unfortunately it is not possible to run the iOS Simulator on Windows at all, which is a limitation from Apple.
I haven't used it before, but apparently you can do so using Nativescript Sidekick.
Yes, flutter is the key to do it,
But I don't recommend it because its still in beta state and to implement it you need to learn a new language i.e dart which feels similar to Java at start but is actually very different also you won find any book or tutorials.
While their is 1 more solution
You can download McOs virtual machine but it would be very slow, recommended only if you have a powerful computer

Unable to switch to WebView context on iOS Appium test (AWS Device Farm)

I'm using AWS Device farm, and I'm running an Appium Java TestNG test on an hybrid Cordova app (iOS), which contains a WebView, but when I get the available contexts, there's only "NATIVE_APP".
After some research, I've found that you have to launch ios-webkit-debug-proxy to be able to switch contexts on real devices, but I also read that it is automatically launched on AWS Device Farm iOS tests.
When I run the test, the Appium Server Output shows this:
[iOS] Attempted to get a list of webview contexts but could not connect to ios-webkit-debug-proxy. If you expect to find webviews, please ensure that the proxy is running and accessible
Is there any additional configuration needed in order to be able to switch contexts on iOS? If not, does anyone know what can be causing this issue?
Appium 1.6.3 or above is compatible with iOS 10 on device farm.
The issue you pointed out seems to be a recurring issue as noticed on the Appium forums.
The ios-webkit-debug-proxy is automatically launched on device farm.
We are currently in the process of deploying support for Hybrid apps which will enable you to run apps based on Cordova.
Right now the support is only for native apps.
Hope that helps.

Can I debug installed hybrid ios app from windows

My phonegap app is crashing randomly in some ios devices, not happening from phonegap client.
Is there a way to debug an installed ios app with a windows pc ?
Debug a Cordova app is a pain. Since the app is running inside a browser-like, all native debuggers are unuseful. In you specific case, I can suggest you to use Weinre, a remote tool able to show you something as the app is running and you can maybe catch the bug you're seeking.
You can start reading this link or this link and maybe google WEINRE.
Since your iOS app is crashing, most probably the issue will be with the Native Code.
BTW, you can try checking this tool - GapDebug

Resources