AnchovyLegend
AnchovyLegend

Reputation: 12538

Using localhost database API on iOS device

I'm currently working on an application tied to a nodejs localhost database API. When I test on the iOS simulator, I am getting API data back successfully. However, when I try to test on the iOS device, the application is still making a HTTP request to the localhost API and failing to retrieve the API data.

My question is, is it possible to somehow set up the localhost database API to work on the actual iOS device? if so, what is the best way of going about it?

thank you

Upvotes: 1

Views: 3192

Answers (1)

Mark Filter
Mark Filter

Reputation: 463

There is a simple fix that will allow your iOS app to connect to your localhost server. What you need is a tunnel that will push your HTTP GET, POST, PUT, and DELETE messages from a device to your local server and return your localhost response back to the client. I wrote a blog article on this very thing with a video that walks you through it. I used ngrok.com. I DO NOT get any kickbacks for recommending them. You can have your localhost server interacting with your deployed mobile app, as well as your app running on your simulator.

The Blog Post: http://markzfilter.com/connect-ios-android-app-local-host-server/

The Service I Use (FREE): https://ngrok.com/

Upvotes: 1

Related Questions