English | 简体中文
Open the iOS project with Xcode and create Network Extension
: File -> New -> Target -> select it and click Next
Enter the name of the Network Extension
(e.g. NEOvpn) and refer to the following diagram for other configurations (note that the Team needs to be consistent with the container App)
Open the Apple Developer website
The
group
andidentifier
may have been created automatically when you added theNetwork Extension
- Create
group
:Identifiers -> App Groups -> Click the+
icon to add - Network Extension App
- Create
identifier
- Identifiers -> App IDs -> Click the
+
icon to add - Enter the bundle identifier of
Network Extension
- Add the following
Capabilities
- App Groups, select the previously created
group
- Network Extensions
- Personal VPN
- App Groups, select the previously created
- Identifiers -> App IDs -> Click the
- Create
profile
- Profiles -> Click the
+
icon to add - Select iOS App Development/Ad Hoc/App Store
- Select the App ID of
Network Extension
- Download after generation and double-click to install
- Profiles -> Click the
- Create
- Container App
- Edit your container App identifier, adding the following
Capabilities
- App Groups, select the previously created
group
(the container App andNetwork Extension
use the same group) - Network Extensions
- Personal VPN
- App Groups, select the previously created
- Re-create the container App's
profile
and install
- Edit your container App identifier, adding the following
Reopen Xcode and select the Signing & Capabilities
tab
- Network Extension App
- Uncheck
Automatically manage signing
and select the appropriateprofile
- Click
+ Capability
in the upper left corner to add the followingCapabilities
- App Groups, check the previously created
group
- Network Extensions, check
Packet Tunnel
- Personal VPN
- App Groups, check the previously created
- Uncheck
- Add the same
Capabilities
asNetwork Extension
to the container App
-
Run
brew install carthage
to get Carthage -
Create the
Cartfile
file in theios/
directory, addgithub "ss-abramchuk/OpenVPNAdapter"
, and runcarthage update
-
Drag the
OpenVPNAdapter.framework
under theios/Carthage/Build/iOS
directory to theFrameworks and Libraries
of the Network Extension target, and selectDo Not Embed
-
Select the
Build Phases
tab of the container App target- Click the
+
icon and chooseNew Run Script Phase
,add/usr/local/bin/carthage copy-frameworks
- Create the
input.xcfilelist
andoutput.xcfilelist
files in theios/
directory - Add
input.xcfilelist
toInput File Lists
ofRun Script Phase
- Add
output.xcfilelist
toOutput File Lists
ofRun Script Phase
- Click the
Cartfile/input.xcfilelist/output.xcfilelist
file contents refer to the files in the apple/
directory of this project
For other installation methods, please refer to OpenVPNAdapter installation
When creating Network Extension
, the project will create the corresponding file at the same time
Copy the contents of the PacketTunnelProvider.h/m
file in the apple/
directory of this project to the corresponding file in Network Extension
- If you want to use the
Swift
version ofNetwork Extension
, please refer to OpenVPNAdapter usage - The
version
andbuild
of the container App should be consistent with theNetwork Extension
, otherwise a warning will be generated when the app is uploaded to the App Store - The
iOS version
in theDeployment info
ofNetwork Extension
should be set to the appropriate value, otherwise the device may not be able to open the VPN properly.