Hello @Erel
With the
Try Catch, I got the "Error loading file".
To find out what error I got, I copied the
Msgbox(File.ReadString("", f), "") and pasted it right after the "
Dim f as string":
Dim f As String = Url.SubString(7) 'remove the file:// scheme.
Msgbox(File.ReadString("", f), "")
Try
Msgbox(File.ReadString("", f), "")
Then I got this error (copy from the log...) :
Application_Start
Application_Active
Application_Inactive
Application_Background
Application_Foreground
openURL: file:///private/var/mobile/Containers/Data/Application/75E998B0-F7C6-43B7-86D4-62DBC8E4772F/tmp/b4i.test-Inbox/Test%202.txt, (null), (null)
Application_Openurl
file:///private/var/mobile/Containers/Data/Application/75E998B0-F7C6-43B7-86D4-62DBC8E4772F/tmp/b4i.test-Inbox/Test%202.txt
/private/var/mobile/Containers/Data/Application/75E998B0-F7C6-43B7-86D4-62DBC8E4772F/tmp/b4i.test-Inbox/Test%202.txt
Error occurred on line: 76 (Main)
Error reading file: Error Domain=NSCocoaErrorDomain Code=260 "The file “Test%202.txt” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/private/var/mobile/Containers/Data/Application/75E998B0-F7C6-43B7-86D4-62DBC8E4772F/tmp/b4i.test-Inbox/Test%202.txt, NSUnderlyingError=0x283d66c10 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
Stack Trace: (
CoreFoundation A68FCE15-6C1A-38C6-9ED3-7063272D237E + 39568
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation A68FCE15-6C1A-38C6-9ED3-7063272D237E + 975724
B4i Example -[B4IFile ReadString2:::] + 428
B4i Example -[B4IFile ReadString::] + 108
B4i Example -[b4i_main _application_openurl::] + 884
CoreFoundation A68FCE15-6C1A-38C6-9ED3-7063272D237E + 458224
CoreFoundation A68FCE15-6C1A-38C6-9ED3-7063272D237E + 128312
B4i Example +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1400
B4i Example -[B4IShell runMethod:] + 420
B4i Example -[B4IShell raiseEventImpl:method:args::] + 1968
B4i Example -[B4IShellBI raiseEvent:event
arams:] + 1360
B4i Example -[B4IAppDelegate application
penURL:sourceApplication:annotation:] + 704
UIKitCore AA0A89BD-E48F-31DB-AD5C-5C724CE77D12 + 4596772
UIKitCore AA0A89BD-E48F-31DB-AD5C-5C724CE77D12 + 13025228
UIKitCore AA0A89BD-E48F-31DB-AD5C-5C724CE77D12 + 13024916
UIKitCore AA0A89BD-E48F-31DB-AD5C-5C724CE77D12 + 7930016
libdispatch.dylib 19F4CD59-AB92-3ED4-9730-174FA4B1468E + 407632
libdispatch.dylib 19F4CD59-AB92-3ED4-9730-174FA4B1468E + 411592
libdispatch.dylib 19F4CD59-AB92-3ED4-9730-174FA4B1468E + 286488
libdispatch.dylib 19F4CD59-AB92-3ED4-9730-174FA4B1468E + 285584
CoreFoundation A68FCE15-6C1A-38C6-9ED3-7063272D237E + 604232
CoreFoundation A68FCE15-6C1A-38C6-9ED3-7063272D237E + 488660
CoreFoundation CFRunLoopRunSpecific + 584
GraphicsServices GSEventRunModal + 160
UIKitCore AA0A89BD-E48F-31DB-AD5C-5C724CE77D12 + 3625928
UIKitCore UIApplicationMain + 312
B4i Example main + 104
dyld A2AA3A68-07F7-3D52-A49E-D29D136813F3 + 81392
)
Application_Active
"Solution" (sort of...):
I then removed the spaces in all the filenames i tested, and I got rid of the errors.
But...
Why can't I have spaces, or special characters like #, in the filenames in this little test?