iOS Native
If you want to use CocoaPods
Step 1: Add the following to your Podfile
pod 'PZSpeed', :git => 'https://gitlab.packetzoom.net/packetzoom/PZSpeedIOSSDK.git'
Step 2: Install or Update pods by running "pod install" or "pod update" command.
Continue with Step 6 (In Final steps below).
If you want to use downloaded PZSpeed framework, follow the following steps
Step 1: Download the iOS SDK.
Step 2: Add PZSpeed.framework to the Frameworks folder in your Xcode Project. Make sure when prompted, you copy the items if needed.
Step 3: Make sure that the following frameworks and libraries are part of your project:
CoreLocation.framework
SystemConfiguration.framework
CoreTelephony.framework
Foundation.framework
libz.tbd
libc++.tbd
Step 4: in Build Settings>Other Linker Flags, make sure that the flag -ObjC is present
Step 5: in Build Settings>Build Options, set Enable BitCode to NO
Final Steps:
Step 6: Add #import <PZSpeed/PZSpeed.h> to your AppDelegate.m
Step 7: Add [PZSpeedController controllerWithAppID: @"<APP_ID>" apiKey: @"<API_KEY>"]; to your didFinishLaunchingWithOptions method
Step 6: Create a bridging header file if your project does not have it already. Add #import <PZSpeed/PZSpeed.h> to it.
Step 7: Initialize using following code
var pzsc: PZSpeedController = PZSpeedController(appID: "<APP_ID>", apiKey: "<API_KEY>")
Please Contact us if you are using an XCode version prior to 7.0
Advanced Options:
- Configure Regex filters here.
- Add [[PZSpeedController sharedController] usePZ:<Yes|NO>]; to your didFinishLaunchingWithOptions method to switch PZ ON and OFF (For TESTING ONLY)
- Add [PZSpeedController setPZLogLevel:PZLOG_VINFO]; to your didFinishLaunchingWithOptions method to turn On the VINFO logs
- Add PZSpeedController.sharedController().usePZ(<true/false>) to switch PZ ON and OFF (For TESTING ONLY)
- Add PZSpeedController.setPZLogLevel(PZLOG_VINFO) to turn On the VINFO logs
iOS Unity Development
Step 2: Import the PZSpeed Unity package into your Unity project:
2. Assets -> Import Package -> Custom Package...
3. Select the provided .unitypackage, then click Open
4. Make sure all the files are checked, then click on Import
You can tweak various settings in the Inspector for this GameObject.
React Native (iOS)
Step 1: First, download the library from npm:
npm install react-native-packetzoom@latest --save
Step 2: Then install the native dependencies: You can use rnpm (now part of react-native core) to add native dependencies automatically then continue the directions below depending on your target OS.
$ react-native link
React Native versions from 0.30 and above should work out of the box, we cannot guarantee that earlier than 0.30 will have smooth integration experience, it may require additional manual steps like rnpm for example.
Javascript
import Packetzoom from 'react-native-packetzoom'
Packetzoom.init("<APP_ID>", "<API_KEY>")
The XMLHttpRequest API is built in to React Native. This means that you can use third party libraries such as Frisbee, Fetch or Axios that depend on it. Ultimately XMLHttpRequest API is implemented using native NSURLSession API on iOS side and OkHttp3 on Android where PacketZoom native sdk would eventually intercept them.
From now on all your Fetch API, Axios or Apisauce requests will be accelerated by PacketZoom. You can access all NewRelic'sque kind of network analytics data on web dashboard when you login under your account.
iOS
Drag PZSpeed.Framework from RNPacketZoom.xcodeproj to your app frameworks folder like shown bellow:
Make sure you linking against it in Build Phases -> Link Binary with Libraries section
Also make sure that the following frameworks and libraries are part of your project:
CoreLocation.framework
SystemConfiguration.framework
CoreTelephony.framework
Foundation.framework
libz.tbd
libc++.tbd