iOS SDK Documentation

The documentation describes the steps to integrate ActSDK into your iOS project.

Unpacking the Tar file

Untar the SDK
#1

Untar ActSDK_n.nnn.tar.gz. This contains the header files in "includes" and libactmobilemonon.a in "Libs" directory.
Let's say it is extractd to /path/to/ActSDK/

                  tar xzvf ActSDK_n.nnn.tar.gz
                
Untar ThirdPart Support
#2

Untar ActSDK_ThirdParty_n.nnn.tar.gz. This contains the necessary third party frameworks and libraries for Ad integration.

                  tar xzvf ActSDK_ThirdParty_n.nnn.tar.gz
                

Setting up XCode

Setting up the VPN Extension
#1

Let's say that the bundle id for your app is com.mycompany.myapp. Do the following steps:

  • File->New->Target
  • Under 'iOS' tab, in the 'Application Extensions' section, choose "Packet Tunnel Provider Extension".
  • Give the name 'vpnExtension', so the bundle name becomes com.mycompany.myapp.vpnExtension.
    Note: The name is important as the SDK needs the extension to be this name.

Xcode will generate necessary files for the vpnExtension. Overwrite the contents of VPNSDKSample/PacketTunnelProvider.h and VPNSDKSample/PacketTunnelProvider.m into the Xcode generated ones.

Having your own PacketTunnelProvider.m
#2

If you want to override/have your own PacketTunnelProvider.m, in the extension's Info.plist file NSExtension section, there is a value NSExtensionPrincipalClass, this provides the main entry point for launching the extension and must be a .m file, not ActPacketTunnelProvider from the library. You can provide a wrapper .m/h, they need to do nothing but extend ActPacketTunnelProvider.

If the name of which is anything other than "PacketTunnelProvider", then set that name in Info.plist/NSExtension/NSExtensionPrincipalClass.

Please contact support for additional details.

Updating Settings

Updating Build Settings
#1

1) Under "Header Search Paths" add "/path/to/ActSDK/" and set the search to "recursive".

2) Under "Framework Search Paths" add "/path/to/ActSDK/" and set the search to "recursive".

3) Under "Library Search Paths" add "/path/to/ActSDK/" and set the search to "recursive".

NOTE: Please update the above build settings for both, the extension's target and the app's target.
Updating Build Phases
#2

1) Under "Compile Sources", add NSData+Gzip.m and JSONKit.m to the project (present in the ActSDK/Extra directory). Add the Complier Flag -fno-objc-arc (for JSONKit.m)

2) Under "Link Binary With Libraries", click on the '+' sign. Then click on "Add Other...". Navigate to /path/to/ActSDK/Libs and add libactmobilemono.a. Choose "Create Folder References" in the prompt that follows.

3) Under "Link Binary With Liraries", click on the '+' sign. Then in the search box, type and add the following framework libraries:

UIKit.framework
SystemConfiguration.framework
NetworkExtension.framework
libresolv.tbd
libz.tbd
EventKitUI.framework
ImageIO.framework
libsqlite3.tbd
CoreData.framework

NOTE: Please update the above build phases for both, the extension's target and the app's target.
Updating Plist
#3

In your app's plist file, ensure there is a string for "CFBundleDisplayName". Set its value to "Your App VPN" or something similar. This string shows up in the Apple VPN Profiles.

App ID and Provisioning Profiles

In developer.apple.com:
App ID
#1

1) Edit your AppID and enable the following:

App Groups
Network Extensions
Personal VPN

2) Create a new AppID for the VPN Extension. Give it a name "My App VPNExtension" and bundle identifier com.mycompany.myapp.vpnExtension (replace com.mycompany.myapp with your App's bundle id). Enable the following on the newly created AppID.

App Groups
Network Extensions
Personal VPN

3) Go to 'Identifier|App Groups'. Create a new group and give it a name and a group id. Let's say the name is group.actsdk

4) Then go to the AppId of your app, edit it, edit the 'App Groups' and select the newly created group id above.

5) Then go to the AppId of the vpnExtension, edit it, edit the 'App Groups' and select the newly created group id above.

Provisioning Profiles
#2

1) In your app's provisioning profile, ensure it has the entitlement for 'Network Extension iOS'.

2) Create a new provisioning profile for the extension product_code. Ensure it has the entitlement for 'Network Extension iOS'.

3) Now, get back to Xcode. Import these provisioning profiles into your Xcode for the respective targets.

4) Click on 'Capabilities' tab of your app target settings.

Turn on 'Network Extensions'. Choose 'Packet Tunnel' for its capabilities.
Turn on 'Personal VPN'
Turn on 'App Groups' and choose the group that you created earlier (e.g. group.actsdk).

5) For both your App and Extension targets, go to Build Settings and set the 'Enable Bitcode' option to No.

Adding Code

There is no need to add any code to the extension target. Only the app needs to be modified to make calls to [ActSDK] methods. Please see ActSDK.h and VPNSDKSample sample code for reference.