iOS Question Error On Accessing Assets Files:- Fixed

RichardN

Well-Known Member
Licensed User
Longtime User
I have been developing my current project for some while and the main Activity code has been running quite happily for many days.

One day the program starts halting on runtime at 'Page1.RootPanel.LoadLayout("main")' saying there is no such layout. The files tab shows the layout there as expected. I suspected a system-level I/O or sharing problem but the file can be renamed/moved/deleted on the PC as normal.

After opening the layout in the designer and then saving again the exception disappears and the layout becomes accessible to the code once again??? This has now happened on three consecutive boot-ups.

But further down.....
B4X:
Private bmp as Bitmap
...
Fname = "ls-large.jpg"
...

Log("Fname= " & Fname)
bmp.Initialize(File.DirAssets,Fname)        'runtime error on this line
imgBackground.Bitmap = bmp

From the log:
Application_Start
Application_Active
Fname= ls-large.jpg
Error occurred on line: 101 (Main)
Error opening stream: The operation couldn’t be completed. No such file or directory
Stack Trace: (
CoreFoundation <redacted> + 150
libobjc.A.dylib objc_exception_throw + 38.........
I have tried cleaning the project, removed then replaced all the files under the files tab and reinstalled the IDE but I am still getting these file errors.
 

RichardN

Well-Known Member
Licensed User
Longtime User
Fixed:

Remove the project completely from the debug/target device and re-install clean

Probably precipitated by me at some stage... There is some issue of assets/file sync that prevents reading of current assets in code by the presence of legacy assets with the same name/filespec.
 
Upvote 0
Top