PWCore SDK for iOS
这是 Phunware 用于其多屏即服务平台的核心理解版SDK。有关更多详细信息及注册,请访问 http://maas.phunware.com。
注意:这是所有 Phunware SDK 的必备依赖。
需求
- iOS 13.0 或更高版本
- Xcode 12 或更高版本
安装
CocoaPods
为了整合框架,需要使用 CocoaPods 1.10 或更高版本。只需将以下内容添加到 Podfile 中:
pod 'PWCore'
要启用请求访问广告商标识符(IDFA)的授权支持,请添加 DeviceIdentity
子规范。
pod 'PWCore/DeviceIdentity'
文档
文档包含在仓库的“文档”文件夹中,形式包括HTML和.docset。您也可以在此处找到最新的文档:http://phunware.github.io/maas-core-ios-sdk
集成
在您的应用程序代理顶部导入 PWCore
import PWCore
在您的应用程序代理的 application(_:didFinishLaunchingWithOptions:) 方法中初始化 PWCore
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
// These values can be found for your application in the MaaS portal at http://maas.phunware.com/clients.
PWCore.setApplicationID("APPLICATION_ID",
accessKey: "ACCESS_KEY",
signatureKey: "SIGNATURE_KEY")
...
}
位置权限
为了分析目的,在启动 PWCore 时建议使用"When In Use"或"Always"授权位置权限。请遵循Apple最佳实践请求位置权限。
广告商标识符(IDFA)权限
从iOS 14.5开始,访问广告商标识符(IDFA)需要通过Apple的AppTrackingTransparency框架进行授权。启动 PWCore 时鼓励进行授权,并可直接通过SDK请求授权。
switch PWCore.isAdvertisingIdentifierPermissionRequestable {
case .allowed:
PWCore.requestAdvertisingIdentifierPermission { (advertisingIdentifier) in
// Advertising identifier available
print("Advertising Identifier: \(advertisingIdentifier)")
} failure: { (error) in
// Advertising identifier not available
print(error)
}
case .notAllowed:
// Authorization is either restricted or has been previously denied
print("Advertising identifier cannot be requested.")
case .alreadyAuthorized:
// Advertising identifier is already available
print("Advertising Identifier: \(PWCore.deviceID())")
}
归因
PWCore 使用以下第三方依赖关系
组件 | 描述 | 许可证 |
---|---|---|
AFNetworking | 一个可爱且易于使用的iOS和OS X网络框架。 | MIT |
TMCache | 适用于iOS和OS X的快速并行对象缓存。 | Apache 2.0 |
SSZipArchive | 适用于iOS和OS X的文件压缩和解压缩。 | MIT |
隐私
您理解并同意在www.phunware.com/privacy中的Phunware隐私政策。如果您使用Phunware软件需要自己的隐私政策,您也同意将Phunware隐私政策的条款纳入您面向最终用户的隐私政策。
条款
使用本软件须查阅和接受开发者使用的http://www.phunware.com/terms条款和条件。