1
using (var file = await CrossMedia.Current.TakePhotoAsync(options))
{
   .....
}

I am using cross media for take photo in xamarin forms ios(Above code). I am getting this error in app center,

System.IO.DirectoryNotFoundException: 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-0-21-4152..jpg"

How to resolve this error?

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.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean isAsync, System.Boolean anonymous) <0x102720650 + 0x0008f> in <0c3d4da7367647c9a650750b1a4d0c53#649cd0243319b7ca5a9179e97f48de1f>:0 \n  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, 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"
  }
}
SoftDev
  • 277
  • 1
  • 3
  • 13
  • SoftDev : This Exception occurs when you are trying to store file right? have you create directory before storing data into it? – Krunal Bagadia Feb 04 '21 at 07:30
  • CrossMedia creating a directory for android and ios. I am able to seen path directory in android. Can't see directory in ios. Is there any possibility to see the ios device file directory? – SoftDev Feb 04 '21 at 08:03
  • I think I see your issue. Could you please share more of your code where you are storing the file path and retrieving it? – Saamer Feb 09 '21 at 13:11

2 Answers2

0

Assuming that you have posted all the relevant code and that you can reproduce the error with it, then the exception happens in the plug-in. As such you need to submit the issue to the plug-in authors so that they can resolve it.

Ivan Ičin
  • 9,672
  • 5
  • 36
  • 57
0

For some reason you are looking for this file myapp/2266603_21-1-2021-12-1-19-8643..jpg. Notice how there are two ".."?

You should fix your code so it tries to reference myapp/2266603_21-1-2021-12-1-19-8643.jpg instead!

Saamer
  • 4,687
  • 1
  • 13
  • 55