iOS Question LoadBitmap suddenly throws compiler errors

davemorris

Active Member
Licensed User
Longtime User
Hi, Guys

I must of do something to my project - the following code has just started throwing a compiler error

B4X:
    pictureBitMap = LoadBitmap(File.DirAssets, "ImageNotAvailableSmall.png")

The compiler complains about this line of code
B4X:
Application_Start
Error occurred on line: 139 (clsCentreInfo)
Error opening stream (/private/var/mobile/Containers/Data/Application/A6568850-CCD3-4489-AC32-6B3B34CC2204/tmp/virtual_assets/imagenotavailablesmall.png): Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}
Stack Trace: (
  CoreFoundation       <redacted> + 252
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  SuperOrder           -[B4IFile OpenInput::] + 440
  SuperOrder           -[B4IBitmap Initialize::] + 800
  SuperOrder           -[B4ICommon LoadBitmap::] + 136
  SuperOrder           -[b4i_clscentreinfo _load:] + 1612
  SuperOrder           -[b4i_clsmydata _load:] + 516
  SuperOrder           -[ResumableSub_main_Application_Start resume::] + 2736
  SuperOrder           -[b4i_main _application_start:] + 552
CoreFoundation       <redacted> + 144
CoreFoundation       <redacted> + 292
SuperOrder           +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1608
SuperOrder           -[B4IShell runMethod:] + 448
SuperOrder           -[B4IShell raiseEventImpl:method:args::] + 2172
SuperOrder           -[B4IShellBI raiseEvent:event:params:] + 1580
SuperOrder           __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
libdispatch.dylib    <redacted> + 24
libdispatch.dylib    <redacted> + 16
libdispatch.dylib    <redacted> + 1068
CoreFoundation       <redacted> + 12
CoreFoundation       <redacted> + 1924
CoreFoundation       CFRunLoopRunSpecific + 436
GraphicsServices     GSEventRunModal + 104
UIKitCore            UIApplicationMain + 212
SuperOrder           main + 128
libdyld.dylib        <redacted> + 4
)
Application_Active

To my mind it suggests the file ImageNotAvailableSmall.png is missing - It is present and shown under Files Manager, I even tried to remove it and reload it and still have the same problem.

So I then Commented out the line in question and recompiled. Then when I run the App in debug it appears to to display other bitmap images (throwing lots of errors example below)
B4X:
Error loading bitmap: Error opening stream (/private/var/mobile/Containers/Data/Application/C5AB2950-3968-4AD3-97D0-FCDD88A668C0/tmp/virtual_assets/ic_cached_white_24dp.png): Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}

Has anyone any suggestions?

Regards
Dave
 

davemorris

Active Member
Licensed User
Longtime User
Hi Guys
Hold fire I fixed it (should have have searched the forums before posting the question - very sorry about that).

When I searched using "b4i Error opening stream" I got several posts all saying the same thing

Uninstall the existing app from the device and reinstall it.

And It worked!

Sorry - I MUST ALWAYS SEARCH THE FORUM FIRST BEFORE POSTING!

Dave
 
Upvote 0
Top