AR.Cad.IA
入门
要求
- Xcode 10+ (Swift 4.2)
- iOS 12+ 设备
示例应用
要运行示例项目,请克隆仓库,然后在 Example 目录中运行 pod install
安装
CocoaPods
CocoaPods 是 Cocoa 项目的依赖管理器。有关使用和安装说明,请访问他们的网站。要使用 CocoaPods 将 Arcadia 集成到您的 Xcode 项目中,请在您的 Podfile
中指定它。
pod 'Arcadia'
然后从 Xcode 项目目录中运行 pod install
。
使用方法
许可证验证
打开 AppDelegate
并初始化 ArcadiaSDK
。
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//Initialize Arcadia giving your LICENCE KEY as parameter
let license_key = "LICENSE KEY"
ArcadiaSDK.initialize(LICENSE_KEY: license_key)
return true
}
设置隐私描述
更新 info.plist
文件
- 添加相机使用描述,以说明应用将如何使用相机。
<key>NSCameraUsageDescription</key>
<string>Camera access is needed for the AR experience</string>
- 如果您想查看有关应用使用情况的分析数据,请添加位置使用描述。
<key>NSLocationWhenInUseUsageDescription</key>
<string>Location access is needed for analytics</string>
- 如果您想提供保存联系人的功能,请添加联系人使用描述。
<key>NSContactsUsageDescription</key>
<string>Contacts access is needed to save contacts</string>
- 如果您想提供保存事件的功能,请添加日历使用描述。
<key>NSCalendarsUsageDescription</key>
<string>Calendar access is needed to save events</string>
- 如果您想在 AR 体验录制期间提供录音功能,请添加麦克风使用描述。
<key>NSMicrphoneUsageDescription</key>
<string>Microphone access is needed to record the AR experience</string>
- 如果您想提供存储录制视频的功能,请添加库添加使用描述。
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Library addition access is needed to export recorded videos to your Photo Library</string>
实现 AR 体验
- 从 ArcadiaViewController 派生子类并覆盖您需要的回调函数。
Class MyARViewController : ArcadiaViewController {
override func onLoadingStarted(){
print(“Arcadia loading started!”)
}
override func onLoadingProgress(value:Float){
print(“Arcadia loading progress:\(value)”)
}
override func onLoadingCompleted(){
print(“Arcadia loading completed”)
}
override func onNetworkError(){
print(“Network error”)
}
override func onPermissionDenied(permission:ArcadiaPermission){
print(“Error, \(permission) denied”)
}
override func onDeviceNotSupported(){
print(“Device not supported”)
}
override func onTargetFound(targetName:String){
print(“\(targetName) found”)
}
override func onTargetLost(targetName:String){
print(“\(targetName) lost”)
}
override func onRecordingStopped(){
print(“recording stopped”)
}
}