TravnexSDK enables seamless integration of voice chat and tour guide features into your iOS applications. This guide will help you set up and integrate the SDK into your project.
- iOS 14.0+
- Xcode 13.0+
- Swift 5.0+
Add TravnexSDK to your project through Xcode:
- File → Add Package Dependencies
- Enter the package URL:
https://github.com/trav-nex/TravnexSDK_Preview.git
- Select "Up to Next Major Version" with "4.4.0"
Add this to your Podfile:
target 'YourApp' do
use_frameworks!
use_frameworks! :linkage => :static
pod 'TravnexSDK'
end
Add the following keys to your app's Info.plist:
<!-- Microphone -->
<key>NSMicrophoneUsageDescription</key>
<string>TravnexSDK needs access to your microphone for voice chat functionality.</string>
<!-- Location Services -->
<key>NSLocationWhenInUseUsageDescription</key>
<string>TravnexSDK needs access to your location to provide tour guide features.</string>
The SDK requires a privacy manifest file to declare API usage. Follow these steps:
-
Create a privacy manifest in your app project:
- File → New File
- Select "Resource" section
- Choose "App Privacy File" type
- Name it
PrivacyInfo.xcprivacy
- Select your target
- Click Create
-
Add the following content to your
PrivacyInfo.xcprivacy
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>DDA9.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
</array>
</dict>
</array>
</dict>
</plist>
This privacy manifest file declares the following API usage:
- System Boot Time Access
- File Timestamp Access
- Disk Space Access
These permissions are required for proper SDK functionality and voice chat features.
Add the following capabilities to your Xcode project:
- Background Modes:
- Audio, AirPlay, and Picture in Picture
- Background fetch
- Background processing
- Voice over IP
To enable these capabilities:
- Select your target in Xcode
- Go to "Signing & Capabilities"
- Click "+" and add "Background Modes"
- Enable the required background modes
import UIKit
import TravnexSDK
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Configure SDK
let config = Travnex.Configuration(
apiKey: "YOUR_API_KEY", // Obtain from Travnex
serviceUrl: "YOUR_SERVICE_URL" // Obtain from Travnex
)
// Initialize SDK
Travnex.shared.initialize(with: config)
// Add Travnex button to your view
Travnex.shared.addTravnexButton(
to: view,
userId: "USER_ID",
tourId: TOUR_ID
)
}
}
apiKey
: Your unique API key (obtain from Travnex)serviceUrl
: Your service URL (obtain from Travnex)userId
: Unique identifier for the current usertourId
: Identifier for the specific tour
The SDK automatically configures the audio session for optimal voice chat performance. No additional configuration is required.
The SDK handles background processing for continuous operation. Ensure you've enabled the required background modes in your app's capabilities.
Common issues and solutions:
-
Microphone Access Denied
- Ensure microphone permission is properly configured in Info.plist
- Guide users to enable microphone access in device Settings
-
Location Services Unavailable
- Verify location permission is configured in Info.plist
- Check if location services are enabled on the device
-
Background Processing Issues
- Confirm all required background modes are enabled
- Verify app is properly signed with required capabilities
-
Initialization
- Initialize the SDK as early as possible in your app lifecycle
- Preferably in
application(_:didFinishLaunchingWithOptions:)
-
Resource Management
- The SDK automatically manages system resources
- No manual cleanup is required
-
Error Handling
- Implement proper error handling for SDK operations
- Monitor SDK status through provided delegates
import UIKit
import TravnexSDK
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Configure SDK early in app lifecycle
let config = Travnex.Configuration(
apiKey: "YOUR_API_KEY",
serviceUrl: "YOUR_SERVICE_URL"
)
Travnex.shared.initialize(with: config)
return true
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Add Travnex button when view loads
Travnex.shared.addTravnexButton(
to: view,
userId: "USER_ID",
tourId: TOUR_ID
)
}
}
For support, please contact:
- Email: [email protected]
- Website: https://travnex.com/support
- Documentation: https://docs.travnex.com
TravnexSDK is available under a commercial license. Contact Travnex for licensing information.
© 2024 Travnex. All rights reserved.