[Solved] App works on wifi but not over mobile network

Hi All,

I created a meteor mobile app (Cordova). It gets all its data from calling an api of a rails app that I had previously created. When I run this app on my locale device for testing, it calls the api and recieves results on the phone (Iphone 65, IOS 10) correctly and quickly. If I switch the phone from wifi to mobile data (3G) the http requests not able to get information from API calls.

I have no idea what could be causing this, any ideas would be appreciated

Are you making sure to set the right network access rules for production?

@streemo

I setting this in the mobile-config.js

App.accessRule('*');

Is there anything else im missing? If it works over wifi, could the same rules prevent it form working over 3G?

Where are you hosting your app when you connect to it over the global
network?

@streemo

My app is not hosted anywhere, I make a meteor app and I build/compile to an ios app. It has no database too, its content 100% come from results of various API calls to the same website

Are you able to even connect to the app? I don’t see how thats possible unless you’re on the same local network if you’e not hosting it somewhere non-local.

Over wifi it will be able to connect to your local server. It won’t be able to do that when you are on mobile. That’s why you encounter the issue.

In general meteor needs a server. There may be tricks around it but that’s not standard. It’s not directly the platform to use in a offline-only scenario.

You guys (@streemo and @lucfranken) are 100% correct. I assumed that because I was using API to populate the app and did not use a database, that a cordova ios build would not need a server. but that is incorrect. For the app to work I need a sever running and the app has to be on the same wifi as the localserver.

Thanks for all your patience and help. Hopefully this answer will help someone else too

2 Likes

No problem. I ran into a lot of these same issues with Cordova, as well. For example, ROOT_URL not being defined properly, or being reverted back to localhost for some reason. Make sure you are specific with --server and --mobile-server flags. Sometimes you might even have to go into XCode and manually set the runtime url, it’s not super predictable. I eventually ditched all forms of Cordova for RN, which is a decision I am glad I made.