我正在使用带有WiX的自定义BA,我想检测是否存在挂起的重启以在用户尝试安装之前警告我的用户,只是让它失败. 如何在Burn(WiX)中引用Reboot Pending属性 这个问题只显示了什么不起作用,并且OP标记了答案,因此没有人回答他的后续问题,"已经被告知Burn中的RebootPending属性可能与Windows Installer使用的属性不完全对应,我还能确保在重新启动挂起时我的应用程序不会尝试安装吗?" 这就是我想知道的.
我正在构建一个OS X应用程序,因为它使用了相机,我想知道什么时候新的可用或当一个消失(被拔掉).我希望以下代码是当我插入一个新的USB摄像头或拔掉一个USB摄像头时,我会得到不同的可用设备数.但是,计数永远不会改变.如果我在没有安装摄像头的情况下开始输出1(对于内置摄像头),并且在插入新的USB摄像头后仍然保持1.同样地,如果我从2开始并使用运行的应用程序拔掉它,则在拔下相机后仍然会显示2.
如果我重新启动整个应用程序,它始终会报告正确数量的设备.
appDelegete:
-(void)startLoop
{
while (true)
{
[self getCams];
usleep(1000000);
}
}
-(void)getCams
{
cameraTest *test = [[cameraTest alloc] init];
[test enumerateDevices];
}
cameraTest:
-(void)enumerateDevices
{
NSArray *devices = [AVCaptureDevice devicesWithMediaType: AVMediaTypeVideo];
NSLog(@"Number of devices found: %lu", (unsigned long)devices.count);
}
Run Code Online (Sandbox Code Playgroud)
如何在我的应用运行时获取更新的设备数量?
我也试过订阅
AVCaptureDeviceWasConnectedNotification和AVCaptureDeviceWasDisconnectedNotification
testCamera:
-(id)init
{
self = [super init];
if (self)
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(cameraAdded:)
name:AVCaptureDeviceWasConnectedNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(cameraRemoved:)
name:AVCaptureDeviceWasDisconnectedNotification
object:nil];
}
return self;
}
-(void)cameraAdded:(NSNotification *)notification
{
NSLog(@"A camera was added");
}
-(void)cameraRemoved:(NSNotification …Run Code Online (Sandbox Code Playgroud)