IOS SDK
Shoplive iOS SDK
是一个移动 SDK,允许用户通过应用程序快速方便地为客户提供服务。Shoplive PIP(图片嵌入)
和原生键盘 UI
使智能手机上的移动体验无缝。
要求
这些是使用 Shoplive SDK 的最低要求。如果您不满足这些要求,则无法使用 Shoplive SDK。
- Xcode 14 及以上
- iOS 11 及以上
- iOS 部署目标 11.0 及以上
- Swift 5.0 及以上
开始之前
要使用 Shoplive SDK,请向 Shoplive 代表请求管理员账户和密码。
- [提出请求]
- [管理员指南 - 创建管理员账户]
在 Shoplive 管理员中添加活动并记录活动键。
入门指南
1. 安装
选择以下方法之一来安装 iOS Shoplive SDK。
❗️请不要重复安装。
必须使用“CocoaPods”或“Swift包管理器”来安装 iOS Shoplive SDK。
- CocoaPods
将以下行添加到 Podfile。
source 'https://github.com/CocoaPods/Specs.git'
# Set it as the same minimum supported version of the project.
# Shoplive SDK for iOS supports iOS 11.0 and above. You cannot set it below iOS 11.0.
platform: ios, '11.0'
use_frameworks!
# Set Project Target for Shoplive SDK for iOS installation.
target 'PlayShopLive' do
#livePlayerSDK
pod 'ShopLive', '1.5.4'
pod 'ShopliveSDKCommon' , '1.5.4'
end
- Swift包管理器
一旦您的 Swift 包设置好了,将 Shoplive SDK 添加为依赖项就像将其添加到 Package.swift 的 dependencies 值一样简单。
dependencies: [
//player
.package(url: "https://github.com/shoplive/ios-sdk.git", .upToNextMajor(from: "1.5.4"))
.package(url: "https://github.com/shoplive/common-ios", .upToNextMajor(from: "1.5.4"))
]
2. 如何运行 Shoplive SDK for iOS 播放器
- 使用准备好的访问密钥初始化 Shoplive Android SDK。
// MainViewController.swift
class MainViewController: UIViewController {
...
override func viewDidLoad() {
super.viewDidLoad()
// Initialize the Shoplive Android SDK using the prepared Access Key.
ShopLiveCommon.setAccessKey(accessKey : "{AccessKey}")
// Play the video using the campaign key.s
ShopLive.play(data: .init(campaignKey : "{CampaignKey}"))
// Starts a muted campaign as an in-app PIP.
ShopLive.preview(data: .init(campaignKey : "{CampaignKey}"), completion: nil)
}
...
}