iOS Question MakeDir not working

Alexander Stolte

Expert
Licensed User
Longtime User
I have tried to create a directory with this code:
B4X:
File.MakeDir(File.DirLibrary,"caches")
but i get this error:
B4X:
Error occurred on line: 194 (b4xp_mycontent)
Failed to create directory: Error Domain=NSCocoaErrorDomain Code=4 "The file “caches” doesn’t exist." UserInfo={NSFilePath=/Users/alexanderstolte/Library/Developer/CoreSimulator/Devices/0B8E7103-C680-4475-B39C-042F80955814/data/Containers/Data/Application/307DDF48-97DE-4929-A72C-96AB34BD30CE/Library/caches, NSUnderlyingError=0x600001a0fd20 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Stack Trace: (
  CoreFoundation       __exceptionPreprocess + 350
  libobjc.A.dylib      objc_exception_throw + 48
  CoreFoundation       +[NSException raise:format:] + 188
  myapp            -[B4IFile MakeDir::] + 332
  CoreFoundation       __invoking___ + 140
  CoreFoundation       -[NSInvocation invoke] + 321
  myapp            +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1669
  myapp            -[B4IShell runVoidMethod] + 202
  myapp            -[B4IShell raiseEventImpl:method:args::] + 1933
  myapp            -[B4IShellBI raiseEvent:event:params:] + 1357
 myapp            +[B4IDebug delegate:::] + 72
 myapp            -[b4i_b4xp_mycontent _downloadorsetimage:::] + 413
 myapp            -[b4i_b4xp_mycontent _xclv_page2_visiblerangechanged:::] + 7456
 CoreFoundation       __invoking___ + 140
 CoreFoundation       -[NSInvocation invoke] + 321
 myapp            +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1669
 myapp            -[B4IShell runMethod:] + 401
 myapp            -[B4IShell raiseEventImpl:method:args::] + 2361
 myapp            -[B4IShellBI raiseEvent:event:params:] + 1357
 myapp            __33-[B4I raiseUIEvent:event:params:]_block_invoke + 51
 libdispatch.dylib    _dispatch_call_block_and_release + 12
 libdispatch.dylib    _dispatch_client_callout + 8
 libdispatch.dylib    _dispatch_main_queue_callback_4CF + 1042
 CoreFoundation       __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
 CoreFoundation       __CFRunLoopRun + 2041
 CoreFoundation       CFRunLoopRunSpecific + 404
 GraphicsServices     GSEventRunModal + 139
 UIKitCore            UIApplicationMain + 1605
 myapp            main + 112
 libdyld.dylib        start + 1
)
 

Semen Matusovskiy

Well-Known Member
Licensed User
An error message is wrong and confuses only, Even you run an application a first time, File.DirLibrary already has subfolders Caches, SplashBoard, Preferences.
This is true at least in IOS 13 (I don't think that this is somehow relative to B4i)
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
When strange things happen on the simulator, the first thing that you need to do is to test it on a real device.
i can only test on real devices from september on, until then i use DirTemp

An error message is wrong and confuses only, Even you run an application a first time, File.DirLibrary already has subfolders Caches, SplashBoard, Preferences.
This is true at least in IOS 13 (I don't think that this is somehow relative to B4i)
I don't get it. When I check if the folder caches already exists, "false" comes out.
 
Upvote 0
Top