Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Alexj17

macrumors newbie
Original poster
Aug 17, 2010
9
0
Liverpool
Hey All

I am a little confused on how to go about and do this....

On each page of my app i connect to PHP file to drag in data from my server. I have about 10 pages. Now if there is no connection to the internet then of course now data can be received.

Often the app crashes and we are putting this down to not having the data due to a change in connection or wifi whatever.

Now i have setup the reachability thing and that works, but i dont know how to link this in with the PHP calls. Should i check the reachability and if no connection then dont run the call. If so, what about all the variables, they will still be null and cause an error then?

I dont really know what is the best solution.

Hope you can help
Alex
 
Should i check the reachability and if no connection then dont run the call.
Correct.

If so, what about all the variables, they will still be null and cause an error then?
Your app probably needs to handle the possibility that the data is null. If your app is completely reliant on an internet connection, you should check for that upon startup and notify the user if it's not available. Then I think all you can do is leave the app in a sort-of "limbo" state.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.