iOS Question File.Exists errors out with "The file "false" couldn't be opened".

Yuri Cinesi

Licensed User
I'm experiencing a very strange bug with File.Exists.
This section of code
If File.Exists(InternalsDirectory,"AccountType") = False Then
    If auth.CurrentUser.IsInitialized Then
        If File.Exists(InternalsDirectory,"appleUID") Then
        End If
    End If
End If
errors out with the message

Error occurred on line: 398 (Main)
Error reading file: Error Domain=NSCocoaErrorDomain Code=260 "The file “false” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/EA30ED76-0210-4ED5-B2A2-44E9178F61FC/Library/false, NSUnderlyingError=0x2835ab4e0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Stack Trace: (
  CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 1157612
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 120016
  MicApp               -[B4IFile ReadString2:::] + 532
  MicApp               -[B4IFile ReadString::] + 120
  CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 1175856
  CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 8656
  MicApp               +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
  MicApp               -[B4IShell runMethod:] + 448
  MicApp               -[B4IShell raiseEventImpl:method:args::] + 1648
MicApp               -[B4IShellBI raiseEvent:event:params:] + 1580
MicApp               -[B4IDebugResumableSub resume::] + 356
MicApp               __21-[B4ICommon Sleep:::]_block_invoke + 60
libdispatch.dylib    AF27E74C-BE4A-3364-BB27-AED9916CE02D + 397952
libdispatch.dylib    AF27E74C-BE4A-3364-BB27-AED9916CE02D + 25488
libdispatch.dylib    AF27E74C-BE4A-3364-BB27-AED9916CE02D + 94380
libdispatch.dylib    AF27E74C-BE4A-3364-BB27-AED9916CE02D + 65340
CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 632288
CoreFoundation       F3021642-E3C0-33F8-9911-DD303A6056D0 + 608904
CoreFoundation       CFRunLoopRunSpecific + 572
GraphicsServices     GSEventRunModal + 160
UIKitCore            CC6E5AC7-8248-35F6-8B42-2E25C93DCF0A + 11723508
UIKitCore            UIApplicationMain + 164
MicApp               main + 112
libdyld.dylib        0B475C78-3C12-3121-B7F8-2B95B83DAF44 + 5480

I've tried removing the = False from the first line, and it seems like it simply crashes on the first line containing a File.Exists that returns false. I've had it crash on line 400 for example, instead of 398 (the "appleUID" one).

Absolutely clueless as to what's happening - I've tried cleaning the project to no avail, as well as deleting the app and reinstalling it.
I'm using a hosted builder, and the app is running on a real iPhone 6S.

I've been unable to reproduce the issue in a smaller project. I'm on b4i version 7.50.

For reference, the InternalsDirectory variable is a global variable defined as File.DirLibrary.
Last edited:

Yuri Cinesi

Licensed User
So the error is simply pointing to the incorrect line then? I'll try to find the offending line manually.

Yep, the error was somewhere else. Not sure why the crash pointed to the wrong line, but it's fixed either way.
Last edited:
Upvote 0