Occipital Structure Sensor 添加流程
2018-09-10 本文已影响0人
梁间
1、 添加引用
2、设置 Build Settings->Enable Bitcode 设为 No
3、 ViewController.m改后缀为ViewController.mm
4、info.plist中添加以下项
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
<string>video-camera</string>
<string>gyroscope</string>
<string>accelerometer</string>
<string>opengles-2</string>
</array>
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>io.structure.control</string>
<string>io.structure.infrared</string>
<string>io.structure.depth</string>
</array>
5、修改ViewController.mm
@interface ViewController ()<STSensorControllerDelegate,AVCaptureVideoDataOutputSampleBufferDelegate> {
STSensorController *_sensorController;
IBOutlet UILabel *messageLabel;
}
...
- (void)viewDidLoad {
[super viewDidLoad];
//启动Structure Sensor
_sensorController = [STSensorController sharedController];
_sensorController.delegate = self;
}
...
-(void)test{
//测试代码
STSensorControllerInitStatus result = [_sensorController initializeSensorConnection];
if (result == STSensorControllerInitStatusSensorNotFound)
messageLabel.text=@"[Debug] No Structure Sensor found!";
else if (result == STSensorControllerInitStatusOpenFailed)
messageLabel.text=@"[Error] Structure Sensor open failed.";
else if (result == STSensorControllerInitStatusSensorIsWakingUp)
messageLabel.text=@"[Debug] Structure Sensor is waking from low power.";
else if (result == STSensorControllerInitStatusSuccess)
messageLabel.text=@"[Debug] Structure Sensor success.";
else if (result == STSensorControllerInitStatusAlreadyInitialized)
messageLabel.text=@"[Debug] Structure Sensor already initialized.";
}
补:Occipital Structure Sensor 需要使用iOS设备的lighting接口,所以我们在使用Xcode真机调试使用改设备的App时需要使用无线调试,Xcode 9 以上版本提供了无线调试功能。