As far as it known for me there are classical lifecycle of iOS
application
That’s true, but it doesn’t really apply to an NE appex. An NE appex runs in a separate process from the container app. The lifecycle of that process is independent of the container app. Rather, the appex acts like a plug-in to the system — in appex terminology, the plug-in’s host is the system itself — and it’s the system that controls when it starts and stops.
1. When in classical lifecycle Network Extension running?
2. What should be done for Network Extension in case of Application is
in or out of Active/Inactive/Background/Suspended state?
Given the architecture I’ve explained above, these questions aren’t meaningful.
3. What should be done by Application in case of something wrong in
Network Extension and how NE could be noticing about own state?
If the user actively runs your NE appex’s container app, it can monitor the extensions state using three different mechanisms:
However, the container app may not be running, in which case your provider is on its own. If it needs to get the user’s attention, it should post a local notification using the User Notifications framework.
IMPORTANT In a managed environment it’s common for a site admin to configure your provider using a configuration profile. In that case it’s possible for your appex to run without the user ever having run your app.
4. Is there any limits for Network Extension? Memory? CPU usage Time?
Access to something? Etc ...
NE providers have many limits. For example, they can’t display UI. However, the one that folks most commonly bump into is the memory limit. See this post.
5. Is there any examples of "best practice" of how to orginise
communication between Application and Network Extension?
From Apple? Not really. We have no good NE provider sample code [1]. Moreover, it’s hard to capture best practice because there’s such a wide variety of requirements across NE providers.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] The canonical example here is SimpleTunnel, but it’s now very out of date.