使用 requestDownloadFile:... 下载后删除 ICCameraDevice 不起作用

问题描述

我正在尝试从 ICCameraDevice 下载工作。大多数情况下确实如此,但 ICDeleteAfterSuccessfulDownload 的“下载后删除”选项似乎不起作用。这是我下载一项的代码

NSDictionary *downloadDict = [NSDictionary dictionaryWithObjectsAndKeys:
                              [NSURL fileURLWithPath:reviewPath],ICDownloadsDirectoryURL,[NSNumber numberWithBool:NO],ICOverwrite,[NSNumber numberWithBool:deleteAfterDownload],ICDeleteAfterSuccessfulDownload,[NSNumber numberWithBool:YES],ICDownloadSidecarFiles,nil];
ICCameraFile *filetoDownload = [importItems objectAtIndex:0];

NSLog(@"downloadDict == %@",downloadDict);
NSLog(@"importCamera == %@ (locked == %@)",importCamera,[importCamera isLocked] ? @"YES" : @"NO");

[importItems removeObjectAtIndex:0];
[importCamera requestDownloadFile:filetoDownload options:downloadDict downloadDelegate:self didDownloadSelector:@selector(didDownloadFile:error:options:contextInfo:) contextInfo:NULL];

根据日志,下载字典似乎格式良好:

2021-07-26 12:39:45.529142-0400 ... downloadDict == { ICDeleteAfterSuccessfulDownload = 1; ICDownloadSidecarFiles = 1; ICDownloadsDirectoryURL = "file:///Users/bhaller/Desktop/dltest_exif4/"; IC覆盖= 0; }

而且摄像头说支持文件删除ICCameraDeviceCanDeleteOneFile),并且没有锁定:

2021-07-26 12:39:45.529600-0400 ... importCamera == 
ICCameraDevice <0x108a8c080>:
  delegate                      : <0x10882d4c0>
  deviceRef                     : 0x10000024
  connectionID                  : 0x00000000
  deviceid                      : 0x02000007
  name                          : Canon PowerShot ELPH 110 HS
  locationDescription           : ICDeviceLocationDescriptionUSB
  iconPath                      : systemSymbol.camera
  softwareInstallPercentDone    : 100.000000
  modulePath                    : /System/Library/Image Capture/Devices/PTPCamera.app
  moduLeversion                 : (null)
  moduleExecutableArchitecture  : 0
  type                          : 0x00000101
  UUIDString                    : 34443344-3235-3037-3646-333134434142
  persistentIDString            : 34443344-3235-3037-3646-333134434142
  autolaunchApplicationPath     : 
  capabilities                  : ICCameraDeviceCanTakePictureUsingShutterReleaSEOnCamera
                                  ICCameraDeviceCanDeleteOneFile
                                  ICCameraDeviceCanAcceptPTPCommands
  shared                        : NO
  transportType                 : ICTransportTypeUSB
    usbLocationID               : 0x02240000
    usbProductID                : 0x3241
    usbvendorID                 : 0x04a9
    usbIntefaceClass            : 0x00
    usbInterfaceSubClass        : 0x00
    usbInterfaceProtocol        : 0x00
  timeOffset                    : 0.000000
  hasConfigurableWiFiInterface  : N/A
  isAccessRestrictedAppleDevice : NO

 (locked == NO)

下载成功,文件在我的机器上创建,格式正确。没问题。但该文件并未从相机中删除。我错过了什么?

另外,顺便说一句:我的应用程序连接到这个相机的第二次时间,我得到了这个日志:

2021-07-26 12:41:22.265175-0400 ... Command 'ICAcopyObjectPropertyDictionaryCmd' Failed with error = -1.

也许这在某种程度上是相关的,尽管它不会在第一次连接到相机时发生。我试过谷歌搜索 ICAcopyObjectPropertyDictionaryCmd 并得到了很多 zilch;谷歌似乎对此一无所知。我对 ICA 前缀感到困惑,因为 ImageCapture 使用 IC;这是内部的东西,因此没有记录吗?我什至不知道如何打破这个错误;它看起来NSLog()输出,但显然不是(也不是NSLogv())。难倒我了。

[ADDED:] 在一次会话中从同一台摄像机进行多次下载后,我刚刚得到了另一个神秘的控制台日志,这是我以前从未见过的:

2021-07-26 12:53:23.779117-0400 ... Command 'ICARegisterForEventNotificationCmd' Failed with error = -1.

也不知道这是什么意思;再次,谷歌没有发光。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)