why sometimes network is suddenly unavailable?

i receive some feedbacks about network is unavailable in our app, but for other app network is works.


at that time, both socket connect by ip or http request are all failed.



user may recorver some hours later. these are logs i got from device.


user device information:iOS/12.0 (iPhone10,2

Replies

log:


2018/10/11 12:21:15:208 [Error] failed to connect to host with error: Error Domain=NSPOSIXErrorDomain Code=50 "Network is down" UserInfo=kCFStreamErrorCodeKey=50, _kCFStreamErrorDomainKey=1. Usage: 4, net:unreachable


2018/10/11 12:21:15:212 [WARN] Url connection error, code = -1009, domain = NSURLErrorDomain

FYI, error -1009 is

NSURLErrorNotConnectedToInternet
and error 50 is
ENETDOWN
.

iOS has support for per-app network interface access control — this is used, for example, to implement the Settings > YourAppName > Mobile Data switch — so it’s not impossible for your app to get these errors when the network is actually up. Two questions:

  • Are the users reporting this from China? Chinese iPhones have the ability to restrict access to Wi-Fi as well as WWAN, which presents an extra level of complexity.

  • You wrote:

    user may recorver some hours later

    Is this correlated with changes in connectivity, like a switch from WWAN to Wi-Fi or the reverse?

If you have another user report this problem, see if you can get them to send you a sysdiagnose log taken while things are failing (see the instructions on our Bug Reporting > Profiles and Logs page). This contains a lot of information that is useful in debugging problems like this.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

sorry to reply so late。


First most of our user are in China,

And i understandthe network setting that is different with other countries.

But i am very sure user didn't change any network setting in System Setting before he suddenly cannot access network.



You wrote:
user may recorver some hours later

Is this correlated with changes in connectivity, like a switch from WWAN to Wi-Fi or the reverse?

"recorver some hours later" means after no access to network happened, user may cannot use our app now, he then may use other apps or may don't use iPhone. And maybe several hours later, he picks iPhone, open app again, at that time he can use it again.

But i don't known whether they change network from WWAN to Wi-Fi or the reverse before he can use it again ( i ever confirm to our user whether he change the access setting in system setting page, the answer is no), i think the network change operation is very common, is that will be the reason to recover? if so , when no access to network happened, even user change network by click wifi icon to access byWi-Fi or not, he still cannot access network finally. (that are we confused why network disable suddenly...)


if some bugs happened in our app, the error code should not aways be system error, and even our custom socket connection connect failed, the system http connection should not be failed either。



One more question:

We also get some feedbacks, the network access control setting is already set to enable for all network(both wifi and wwan), but the app is still cannot access network.

We really don't known the right way to recover, each time we ask our user to reset network setting, reboot ios system and other operations, most of them can recover, please tell us the right way to recover.

Is there any chance the user is running a different version of your app, that is, a different app that’s built from the same source code? For example, you might use the same source code to build two different apps each of which is ‘skinned’ for a particular customer via resources?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Almost impossible,users are normal users.

users are normal users.

Understood, but I’m actually talking about your app here. Do you create multiple different apps from the same source base?

The reason this matters is that I’ve seen weird problems with network interface access control when developers build multiple apps from the same source code (that is, they ‘skin’ the same app for different customers). This results in multiple apps having the same binary UUID, and that ends up confusing iOS’s network interafce access control mechanism (r. 30421029). And such problems most often show up for Chinese users, because iPhones sold in China support more network interface access control features.

So I’d like to rule this out before we go further.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

we have some customers that we use very same source code to build a enterprise app , but i am also sure we will modify some source codes to rebuild it (not version, app name, images..., and only provide one company a different app), and users who send the feedbacks are not in this company, i don't think they could get the same uuid binary.


Do you have some other points need me to confirm?


I also will try to get a iOS system Diagnostics from the problem device if we could find a user who want to provide/

i don't think they could get the same uuid binary.

It’s reasonably easy to check this:

  1. Get a copy of the built app on your Mac.

  2. Run the following command:

    $ otool -l MyApp.app/MyApp | grep -B 1 -A 2 LC_UUID
    Load command 8
         cmd LC_UUID
     cmdsize 24
        uuid BB247FBC-FB43-3199-8A30-AE2FA97D6A2E
    --
    --
    Load command 8
         cmd LC_UUID
     cmdsize 24
        uuid 738367BF-437D-396D-8666-C78D50D7F4BA

    .

In this case you see two results, one for each architecture in the universal binary.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"