Communication between the actual device and the virtual environment during iOS development - ios

I'm developing for iOS with Flutter.
I created a virtual environment on my Mac using Virtual BOX and Vagrant, and set up a server to process API requests and return results.
Example of API
localhost:8888/api/result
The problem is this "localhost".
I built it with Android Studio and checked it with the simulator, and found that I could request localhost:8888/api/result and get the result back, no problem.
However, when I checked on the actual iPhone device, I found that communication was not possible.
I think the cause is in localhost.
I expect that localhost will be the iPhone itself when built on the iPhone.
How should I communicate with the virtual environment on my local device at this time?
I want to make API requests to a virtual environment in my local terminal where I built iOS.

It was easy.
All I had to do was edit the Vagrantfile and set the public IP.
Of course, it is in the same local network.
I didn't have to specify the port, just request the API and I was good to go.

Related

iPhone Connectivity for Ford SYNC Applink™ Emulator

I have setup the virtual box and installed Ubuntu and also installed “SYNC Applink™ Emulator” with help of your document (ref link: https://developer.ford.com/pages/tools-ios) in both my Windows and Mac.
I have also configured the Port forwarding setup on virtualBox manager and also I connected both system and iPhone in the same network , but still my iPhone not displayed on Phone tab of Sync emulator.
I have checked with your sample application of HelloSDL and App Store application of Spotify , this 2 application also not showing in Apps tab in Emulator.
please help us solve the problems.
I would suggest to try the following steps in HSDLProxyManager.m class:
In the method startProxy, uncomment the method which connects via TCP/IP and then comment the method which uses USB.
Change the variable RemoteIpAddress according to the ip of your virtual machine.

How do I get my iphone to connect to local Xampp server on my mac while testing an xcode app

I am doing a Ray Wenderlich tutorial how to make an app like "Instagram". It's my first time setting up a database. I am using Xampp and hosting on my mac.
I CAN get the app to run with the xcode simulator and I can log in and it works with the server. However when I run my iphone device it runs the app but when I go to login through the app it says "Could not connect to server".
What am I missing? I think all my permissions are set to anybody etc... But again I'm totally new to using a database. It seems though that if the simulator can do it the phone should be able to. Also it's not a provisioning problem, that profile is valid and it wouldn't run on my app if it wasn't. I just cant get to the database from the device.
Any help would be awesome!
If the app isn't able to connect to the server, there might be an issue with the server address.
When running on the simulator, you're still on your mac, so something like http://localhost/DATABASE_ALIAS is enough. But when running on a different device, that is no longer true.
To keep things simple, you should make sure the iPhone is connected to same network as your Mac and then replace localhost with either the Mac local IP or its Bonjour address, for instance: http://YOUR_MAC_NAME.local/DATABASE_ALIAS.
To find out the Bonjour address, open System Settings and find the machine name under Sharing. As an example, if it is called "Herbie MacBook", the address would be "Herbie-MacBook.local".

how to get ios browser on iphone to view web pages on my local server for testing?

I have an iOS device. I'm developing some html 5 pages that I'd like to view on my iphone while developing. Is this possible. I tried accessing my local server's ip and it wouldn't connect. I'm not sure if there's something else I should try.
I also tried an my Android device evo shift 4g and same thing...it wouldn't connect using the ip.
Any ideas?
Is the local server running correctly configured apache, or some other server software? Can you access the local pages from a browser on the local server itself? Is the firewall letting port 80 connections in?
Are the WiFi devices in the same subnet as the server? What are the IP addresses of the phones? That could happen if you have a wireless router connected to a wired router, and the wireless router is running its own separate DHCP server. Have you tested from computers that are connected to the wireless network?
There shouldn't be anything that prevents an iPhone or an Android phone from connecting to an IP address that it can resolve. I've never had a problem connecting to a (public) IP address from either an iPhone or an Android phone.
I'm running IIS 7 on Windows 7 Professional. Had the same problem. It's a firewall issue. Go to Control Panel\All Control Panel Items\Windows Firewall\Allowed Programs and enable "World Wide Web Services (HTTP)" for "Home/Work (Private)". That worked for me. As my iPhone is in the same network, I now can access my test server by its IP.

Access localhost on Mac from XCode? Phonegap communicating with Ajax to a local Rails app

Is there a way to access http://localhost:3000/posts from within an HTML file that's running through Phonegap for the iPhone on the iPhone device (not the simulator), in XCode?
If I have an HTML5 app in Phonegap, I have only been able to access external stylesheets with file://Users/etc.. or http://... when I'm testing it on the iPhone/iPad itself. If I'm running the simulator, I can access localhost no problem.
Is there a way around this? I know I can access localhost on the Mac from within Parallels running Windows by doing http://username.local/posts, is there something like this for iOS development?
"localhost" always points to 127.0.0.1 in IPv4, which is the current device's loopback network interface. If you open "localhost" from your iPhone, it will point to the iPhone itself.
However, if you are in the same network as your Mac, you can simply use your Mac's IP address, e.g. http://192.168.0.20:3000/posts. You can see your current IP address in your Mac's Network Settings.
Also, depending on your network configuration, using the Bonjour name might work as well. For example: http://mymac.local:3000/posts if the name of your computer is set to mymac in the system preferences' Sharing pane.
Perhaps you could set up your Mac as a Web Server? See ehow link
If you are asking whether you can access localhost on your Mac/PC from your iPhone device, then the answer is no. There's no way for your iPhone to route to another machine's local host address.
You should get your iPhone on the network that the server resides on and use an accessible IP address to access it.

BlackBerry simulator settings for VPN

I want to test a project from the BlackBerry simulator, but our webservice runs on an external server that can only be accessed using the vpn from our PC's.
I can access the webservice from the Android simulator without doing anything special. However I cannot access the webservice from the BlackBerry simulator -- not even from the browser of the simulator -- though I am able to connect to other services on the web from the BlackBerry simulator.
What kind settings are there to fix this?
There's a network setting for the simulator that might be useful for situations like this. You could try manually assigning the vpn ip address you were given.
/ip-address={string}
IP address of the simulated handheld. This should be left blank under normal circumstances. If running on a PC with multiple IP addresses, one can be specified here to cause the simulator to use it.
Cheers
Ray
Ok...anyone bumping on the same problem...
Append ";deviceside=true" to the URL from which data is to be fetched

Resources