问题描述
我目前正在使用一种工具,可以将Windows 10 PC上的图像下载或上传到iPhone(在我的情况下为iPhone X,iOS 14.2)。
对于此工具,我正在使用:
- DLL“ LibiMobileDevice .NET”(https://github.com/libimobiledevice-win32/imobiledevice-net)
- 语言:C#
- 框架:.NET Core或可能的UWP
到目前为止,我已经尝试过:
private void UploadNewFiletoiPhoneDirectory()
{
var afcApi = LibiMobileDevice.Instance.Afc;
ulong handle = 0;
uint bytesWritten = 0;
var image = GetExampleImageFromComputer();
var byteArray = ImagetoByteArray(image); // Returns a byte array from the selected image from my Computer.
afcApi.afc_client_start_service(DeviceHandle,out var afcclientHandle,null).ThrowOnError();
afcApi.afc_file_open(afcclientHandle,@"/DCIM/101APPLE/IMG_9999.PNG",AfcFileMode.FopenWr,ref handle).ThrowOnError();
afcApi.afc_file_write(afcclientHandle,handle,byteArray,(uint)byteArray.Length,ref bytesWritten).ThrowOnError();
}
此方法将图像上传到iPhone。问题是该图片未显示在“照片”应用中。 我发现有一个用于此的数据库(Photos.sqlite)。这意味着,只要图像未存储在数据库中,就不会在图库中显示。 我还读到您永远不要手动更改数据库(https://discussions.apple.com/thread/8089758)。
作为旁注::如果我下载数据库然后再次上传,则手机将自行更新数据库并显示图像。问题在于这是一个非常糟糕的解决方案,最多需要15分钟才能使用户再次使用其“图库”应用。
有人可能还有其他想法吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)