I'm wondering if react-native's Remote Debugger mode would be possible also on real device. But it stops me with an error page stating
"Connecting to http://localhost:8081/debugger-proxy?role=client timed
out"
The interesting fact here is that this URL won't also work on my developer machine.
Opening this URL (http://localhost:8081/debugger-proxy?role=client) in a browser on my developer machine with running packager.js will respond with:
Cannot GET /debugger-proxy?role=client
When I turn off Remote debugger, everything works as expected.
Steps to reproduce:
react-native init testapp
cd testapp/ios
open the .xcodeproj-File with XCode
Select my connected iPhone as target device
Run the application
The application will fetch the source code from my local machine. In order to make this work, both, the iPhone-device and my iMac, are connected to the same WiFi.
The ReactNative-Application is executed on the iPhone as expected. With the shake-gesture I spawn the developer menu and select the option "Debug JS Remotely".
Now this error appears as mentioned above.
Following a side note in running-on-real device I changed the Host from localhost to the IP-Address of my Mac in RCTWebSocketExecutor.m, but this results in an endlos loop while fetching.
The Question is:
How can I use the Remote JS Debugging-Feature on real device?
Update
After further investigation I came to the conclusion that this might be a bug and opened the following issue on GitHub.
In chrome browser, I have changed
localhost:19001/debugger-ui
to
192.168.0.4:19001/debugger-ui
and it worked. Replace 192.168.0.4 with your ip address.
We had a similar issue here in 2020 and now there is a better solution which is to update the IP of the target machine directly from the app. Be on the same wifi with both the computer and the device - even if they are connected with a USB.
Shake the phone to get the menu
Select Configure Bundler
Insert the IP of the computer
Press Apply Changes
Now you should get debug data on the computer.
On iOS devices, open the file RCTWebSocketExecutor.m from react-native/Libraries/WebSocket/RCTWebSocketExecutor.m and change "localhost" to the IP address of your computer, (don't forget the correct port. eg: 192.168.1.6::8880) then select "Debug JS Remotely" from the Developer Menu.
NOTE: remove the app from your device, close the terminal that opened
for creating bundle.js. finally press the Play button from your Xcode.
here is the official guide from react-native website:
Related
Frequently I face this issue where whenever I pressed get button to download anything from Mac App store, A message would pop up saying "A server with the specified hostname cannot be found". I didn't find this issue published anywhere as it is.
I faced this issue hence I wanted to share this with other people.
I was told to wait for 10-20 minutes and retry on the App Store but that failed for me. I changed my wifi form 5G to 2.4G thinking maybe it was a band issue.
What worked for me was:
Go to System Preferences
Go to Network Preferences
Click advanced options
Click DNS settings
Click the + (plus) sign
Add 1.1.1.1
Similarly add 8.8.8.8
This worked for me and I hope this works for you too. You can remove these once you're able to download the app you want from app Store. After removing also you'll be able to download apps.
Try this: Make a network setting refresh. Simply go to /Library/Preferences/SystemConfiguration/ and remove the following files, but don't empty the trashcan.
com.apple.airport.preferences.plist
com.apple.network.identification.plist
com.apple.wifi.message-tracer.plist
NetworkInterfaces.plist
preferences.plist
After this, make a restart and your network will get fixed.
I am writing an app that I need to see the xcode console output i.e. the following
2019-12-27 13:14:37.188270-1000 HelloDroneIOS13[2076:1783918] [arsdkengine] Create ArsdkEngine
2019-12-27 13:14:37.189316-1000 HelloDroneIOS13[2076:1783918] [gsdk.core] Loading engine ArsdkEngine
2019-12-27 13:14:37.189450-1000 HelloDroneIOS13[2076:1783918] [gsdk.core] Starting engines
2019-12-27 13:14:37.206437-1000 HelloDroneIOS13[2076:1783918] [gsdk.core.utility.internet] Started listening for Internet connectivity changes.
I have an accessory I need to attach so I can't have it connected to my laptop when running and it is crashing so I need to figure out the reason. I tried connecting it to my laptop after it crashed then from xcode Window->Devices and Simulators -> Open Console. See image:
This seems to only show the latest console outputs. Where can I access the saved outputs when it crashed? instead of the latest.
I have an accessory I need to attach so I can't have it connected to my laptop when running
Yes you can. Configure your device for wireless connection to Xcode. Now you can attach the accessory device and receive Console output at the same time. That is exactly why wireless Xcode debugging was invented.
(Check "Connect via network", visible in your screen shot.)
Is there a standard way to build iOS apps in xcode such that, when running on a test iphone, the app can connect to a dev server running on my laptop?
For context, I'm making GET/POST requests to a remote server, so I need to choose the right host depending on whether or not it's a prod build.
I started off with #ifdef DEBUG to toggle between http://localhost and https://proddomain.com, but obviously localhost resolves correctly only on the simulator and not on the iphone.
I was hoping there'd be some scheme where you do port forwarding, etc to get it to work the same between simulator and test device. I'm currently hardcoding my local IP in the DEBUG build, and that won't work once more people are working on it.
I like registering a URL handler then using that to configure the app. It can be as simple as typing your custom URL into mobile Safari.
See Implementing Custom URL Schemes and this step-by-step guide.
e.g. if you type myapp://config?endpoint=192.168.0.123:8080 (correctly quoted, of course),
your app will be launched and you can extract the endpoint, overriding your production version.
Hello I am trying to cast the demo videos for iOS in the github reporitory.
When running CastHelloVideo-ios I see that the program finds the device, conects to the device but it never launches the page. I have the same issue with the other samples in the repository.
The only one that was able to run one time is CastHelloText with Application Id "588BF969". Then I tried to create another application ID "70138F0B" for the same project and it doesn't launch the page, this is the log.
2014-02-06 16:46:20.862 HelloTextGoogleCast[8798:60b] device found!! CVC Off
2014-02-06 16:46:20.866 HelloTextGoogleCast[8798:60b] device found!! JBcast
2014-02-06 16:46:22.873 HelloTextGoogleCast[8798:60b] Selecting device:JBcast
2014-02-06 16:46:24.348 HelloTextGoogleCast[8798:60b] connected!!
NO LOG LAUNCHING THE PAGE
PLEASE HELP, what can I be doing wrong if is the same URL for both Application ID's, from the same application. AND yes, I replace kReceiverAppID for each case!!
Thank you
Have you registered your device for your appId on the developer console? Since the 588BF969 app id works (that is a published app Id, meaning that it is allowed to run on all devices) and your app Id doesn't work, I suspect the issue is in your device registration. Please
(1) Double check the serial number of your device on the developer console to makes sure it matches your device's serial number
(2) Makes sure you have checked the box that sends the serial number to google (this is in the setup application for your chromecast). Also try to connect to http://:9222 from a chrome browser on your network to see if your device is whitelisted
(3) Reboot your chromecast to make sure it has picked up the new configuration.
To answer my own question and reply to previous reply, non of my applications in the developer console are published yet, and the serial number in the device is fine because it work for one but not for the other one. Also the box that sends the serial number to google was checked.
The problem seems to be some cache, and it is very easy to fix:
1) find device IP on the settings app and got to chrome browser, enter Device IP plus port 9222, and you would see a white page that says "Chromecast Home Screen"
2)Click on "Chromecast Home Screen" and you will see another screen, look for "console" at the top and click on it
3)Finally enter this command: window.location.reload();
Thats it, after doing this, all my apps start working and if I need to change one of the URL address I do this to refresh and load the new URL.
Thank you
The configuration of allowed apps is cached on the device. When I make changes in the Developer Portal I usually just reboot the device.
I'm writing an iOS app that acts as, among other things, a telnet server. Naturally, it begins listening for connections as soon as it starts.
When I run the app in the Simulator, Mac OS X (I happen to be on 10.7.3) prompts me to Allow or Deny my application to accept incoming network connections. This is the standard Firewall message that Mac OS X uses for all unsigned, networked applications.
I grow weary of clicking "Allow" fifty or more times a day, and so I seek a way of permanently adding my app to the Firewall's list of permitted apps.
I've tried the following.
Open Activity Monitor while my app is running.
Select my app. Click "Inspect".
Go to the Open Files and Ports tab. One of the first lines is the precise path to my app. Copy and paste this path.
Open the Firewall... Advanced settings.
Click the + (add) button.
Browse to the application path and select it, thus adding it to the list of applications for which incoming connections are allowed.
In the last step there's a significant decision. You could add either the .app application package, or Show Contents on that package and add the "Unix executable" within. I've tried both approaches.
Interestingly, Firewall will in fact stop warning you about the app—for a while. After a few runs, however—it isn't clear to me what event actually causes this change, but it happens within half an hour or so for me, generally speaking—Firewall begins warning about the app again.
How do I set Firewall to permanently Allow my iOS app?
Naturally, I could bypass this whole problem by disabling the Mac OS X firewall. I could also avoid ever again getting a splinter in my foot by chopping it off. Neither of these courses of action recommend themselves to me.
What would you suggest?
So we want to suppress the following dialog
Do you want the application “NNN.app” to accept incoming network
connections?
which appear on every activation of the Xcode iOS simulator.
I believe there is now a solution for that. Basing my answer on this blog.
Simply run the following commands in a Terminal window:
#temporarily shut firewall off:
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
#put Xcode as an exception:
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode
#put iOS Simulator as an exception:
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator
#re-enable firewall:
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
For me it worked. Please note simulator address is according to Xcode 8.
After dabbling with this for some time, I found that manually adding the executable itself to the Firewall "Allow" list gives the desired result. You don't add the .app, but rather the "Unix" executable inside the .app's Contents folder. I believed I had tried this file before without success, but currently it's working.
I think the best solution might be to script the process of okaying your app to the firewall.
If I recall correctly, the latest OSX firewall is actually clever about identifying apps and fingerprints the allowed binaries. This prevents the surprisingly effective tactic of just naming your malware "system32.exe" &c to evade the firewall. If that's the case, your app will be (correctly) blocked for not being the same binary that was okayed, and there's not really any way around it.
So, try scripting the firewall allowing process and incorporate that into the build process.
I never had luck with manually adding the executable to the firewall's allowed-list. Here's a solution using an automated mouse click:
Download CLIclick. (Thank you Carsten.)
Put it in a suitable location, say /usr/local/bin.
Get the Allow button's screen coordinates using ⌘⇧4. (In my example, these are x: 750, y: 600.)
Create a script with this content (the w: is the wait time in ms):
/usr/local/bin/cliclick c:750,600 w:1500 m:+0,+0 c:.
(I couldn't get CLIclick to work without "moving" it to the same location (the m:+0,+0 part) and clicking again at the same spot with c:..)
Open Xcode's Preferences / Behaviors and add the above script.
Enjoy!
I don't know if it is the right way but for me worked.
Turn off the firewall
Connect with the iphone app to your mac
Check if everything in the connection working
Turn on the firewall