Hello guys.
My upcoming app (MAD GODS) has been reject by Apple. Even so they did not specifically said why (“app freeze when pressing the run button”) I am suspecting something about the way I am checking for network connection before requesting an ad from Playhaven network. On my device (ios) I can see that if I enable the “network link conditioner” (settings/developer/network…) I can see that the app freezes at start if the I simulate a bad network connection (100% or 70% data loss) I think the this network status simulation only works on ios 7. Anyway I have been using in the past something like this:
[lua]
function testNetworkConnection()
local netConn = require(‘socket’).connect(‘www.apple.com’, 80)
if netConn == nil then
return false
end
netConn:close()
return true
end
[/lua]
I have seen many variation of the above code which seems to not really prevent my Playhaven to be called if there is a bad connection. I have tried codes with network time out but got basically the same issue.
THEN, i found the above post about build-in function for checking internet connection! Of course i did not about that. Still I am having problem implementing since it was always return “false” for some reason!
inside that function (MyNetworkReachabilityListener) he I added the following:
netOK = event.isReachable – netOK is local variable define above the function and use to show or not a Playhaven ad
My problem is that netOK flag is always false? Is that the way to check if the device is connected to the internet (ie: get the status of isReachable?)
Also in the post above (from Carlos) I do not see how/where “network” is define? Should not have something like:
local network = requires (“socket”)
or something like that? or is it something like:
local network = requires (“network”) ???
2 more questions!:
1- Does the build-in internet connection work both on IOS and android? if not what will be a better solution to check for internet connection on both OS?
2- Is there anyway to tell how good/bad the internet connection is? In my case if the connection is good then everything is ok BUT if i simulate a bad connection then the app really behave badly!
THANK YOU! I am really desperate to fix this issue so i can re-submit my app to Apple and see what they say!
Mo