问题描述
using (var file = await CrossMedia.Current.TakePhotoAsync(options))
{
.....
}
我正在使用跨媒体以 xamarin 形式的 ios(上面的代码)拍照。我在应用中心收到此错误,
System.IO.DirectoryNotFoundException:找不到路径的一部分“/var/mobile/Containers/Data/Application/D9CD5B7E-D0AD-41A1-97DA-9B6FC4471955/Documents/myapp/2266603_21-1-2021-12 -0-21-4152..jpg"
Error Message:
{
"length": 0,"offset": 0,"id": "4be55b3c-33f1-4bbf-99a3-b4af8203a0ba","exception": {
"type": "System.IO.DirectoryNotFoundException","message": "Could not find a part of the path \"/var/mobile/Containers/Data/Application/D9CD5B7E-D0AD-41A1-97DA-9B6FC4471955/Documents/myapp/2266603_21-1-2021-12-1-19-8643..jpg\".","stackTrace": " at System.IO.FileStream..ctor (System.String path,System.IO.FileMode mode,System.IO.FileAccess access,System.IO.FileShare share,system.int32 bufferSize,System.Boolean anonymous,System.IO.FileOptions options) <0x102720700 + 0x00214> in <0c3d4da7367647c9a650750b1a4d0c53#649cd0243319b7ca5a9179e97f48de1f>:0 \n at System.IO.FileStream..ctor (System.String path,System.Boolean isAsync,System.Boolean anonymous) <0x102720650 + 0x0008f> in <0c3d4da7367647c9a650750b1a4d0c53#649cd0243319b7ca5a9179e97f48de1f>:0 \n at System.IO.FileStream..ctor (System.String path,System.IO.FileAccess access) <0x102720420 + 0x0006f> in <0c3d4da7367647c9a650750b1a4d0c53#649cd0243319b7ca5a9179e97f48de1f>:0 ","wrapperSdkName": "appcenter.xamarin"
},"properties": {
"message:": "Could not find a part of the path \"/var/mobile/Containers/Data/Application/D9CD5B7E-D0AD-41A1-97DA-9B6FC4471955/Documents/myapp/2266603_21-1-2021-12-1-19-8643..jpg\".",},"appId": "5993bbda-3072-45e5-9418-a260aa66a94f","installId": "761843BC-C04F-4E62-A3EB-C636C58CEFF7","isTestMessage": false,"timestamp": "2021-02-03T03:44:15.833Z","sid": "5e3c4238-d2cc-42da-8ab4-319d4c97b21a","device": {
"sdkName": "appcenter.ios","sdkVersion": "4.0.0","wrapperSdkVersion": "4.0.0","wrapperSdkName": "appcenter.xamarin","model": "iPad7,5","oemName": "Apple","osName": "iOS","osversion": "14.3","osBuild": "18C66","locale": "en_AE","timeZoneOffset": 240,"screenSize": "2048x1536","appVersion": "3.1.1","appBuild": "3.9","appNamespace": "com.myapp","wrapperRuntimeVersion": "12.6.0"
}
}
解决方法
假设您已经发布了所有相关代码并且您可以用它重现错误,那么异常就会发生在插件中。因此,您需要将问题提交给插件作者,以便他们解决。
,出于某种原因,您正在寻找此文件
myapp/2266603_21-1-2021-12-1-19-8643..jpg
。
请注意如何有两个“..”?
您应该修复您的代码,以便它尝试改为引用 myapp/2266603_21-1-2021-12-1-19-8643.jpg
!