Cannot access Document Directory with FileSystem? (iOS)

Please provide the following:

  1. SDK Version: 41.0.1
  2. Platforms(Android/iOS/web/all): iOS

On Android this works: I check if a file in the documents directory exists, and if it does not I create a resumable download and place it there. And I believe it used to work on iOS but I can’t confirm easily.

On iOS I’ve tried 2 different ways:

  1. The getInfoAsync() function tells me the document directory is not readable

Here’s what I get if I console log

[Error: File 'file:/var/mobile/Containers/Data/Application/C4EC8DD9-3D86-452A-8176-6DC3ED3F4697/Documents/006916c4-716d-42c3-8823-9585580b1aad_AA%20Heaps%20Dwg%20Markups-6.jpg -- file:///' isn't readable.]

Here’s the JSON stringified version of the error to show the stack trace (the remote file is prefixed with a uuid)

{
  "code": "ERR_FILESYSTEM_NO_PERMISSIONS",
  "message": "File 'file:/var/mobile/Containers/Data/Application/C4EC8DD9-3D86-452A-8176-6DC3ED3F4697/Documents/inspectrmobile/02298aae-96a6-45d1-9a12-94f7d19d66d4_AA%20Heaps%20Dwg%20Markups-1.jpg -- file:///' isn't readable.",
  "domain": "RCTErrorDomain",
  "userInfo": null,
  "nativeStackIOS": [
    "0   inspectrmobile                      0x0000000104e27a78 RCTJSErrorFromCodeMessageAndNSError + 120",
    "1   inspectrmobile                      0x0000000104dbeddc __41-[RCTModuleMethod processMethodSignature]_block_invoke_2.129 + 152",
    "2   inspectrmobile                      0x0000000105120cb8 __51+[RCTConvert(RNCSafeAreaView) RNCSafeAreaViewMode:]_block_invoke + 5376",
    "3   CoreFoundation                      0x0000000196823a50 4D6DD6DD-22E4-3858-9A0C-3CB77C2F13D6 + 1178192",
    "4   CoreFoundation                      0x0000000196705750 4D6DD6DD-22E4-3858-9A0C-3CB77C2F13D6 + 5968",
    "5   inspectrmobile                      0x0000000105150a38 __destroy_helper_block_e8_32s40r48r56r + 6912",
    "6   inspectrmobile                      0x00000001051560fc UMErrorWithMessage + 9644",
    "7   libdispatch.dylib                   0x00000001964562b0 3BBE17AC-597B-3B79-91AC-21A5523E7BD7 + 393904",
    "8   libdispatch.dylib                   0x0000000196457298 3BBE17AC-597B-3B79-91AC-21A5523E7BD7 + 397976",
    "9   libdispatch.dylib                   0x0000000196433344 3BBE17AC-597B-3B79-91AC-21A5523E7BD7 + 250692",
    "10  libdispatch.dylib                   0x0000000196433e2c 3BBE17AC-597B-3B79-91AC-21A5523E7BD7 + 253484",
    "11  libdispatch.dylib                   0x000000019643d66c 3BBE17AC-597B-3B79-91AC-21A5523E7BD7 + 292460",
    "12  libsystem_pthread.dylib             0x00000001dec6d5bc _pthread_wqthread + 272",
    "13  libsystem_pthread.dylib             0x00000001dec7086c start_wqthread + 8"
  ]
}

  1. If I create a subdirectory and try to download to it I get this error instead despite providing the local URI
Error: Directory for 'file:///var/mobile/Containers/Data/Application/C4EC8DD9-3D86-452A-8176-6DC3ED3F4697/Documents/my app name/MY FILE NAME.jpg' doesn't exist. Please make sure directory '(null)' exists before calling downloadAsync.

Any Suggestions on how to make this work on iOS? Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.