iOS Question bitmap - object not initialized (B4i v7.50 and iOS 14.6)

davemorris

Active Member
Licensed User
Longtime User
Hi Guys

I have a problem with some old code that now throws an error when compiled using the latest version of B4i v7.50 but only on a devices running iOS14.6 - OK on a device running iOS 12.5.4. The same code is cross platform and runs OK on Android devices.

B4i forms designer has a ImageView called imgSuperorder and loaded with an png file at design time.

It is handled by the code below
Code handling imgSuperorder:
' Reference in Class Globals to Superorder Icon.
Sub Class_Globals
    .
    .
    Private imgSuperorder As B4XView ' Superorder header icon
    .
    .
End sub

' This is the code snippet that throws the Error.
    Dim bt As Bitmap ' <- Throws error here (line #510 in the code)
    bt = imgSuperorder.GetBitmap
    imgSuperorder.SetBitmap(bt.Resize(imgSuperorder.Width, imgSuperorder.Height, True))
    imgSuperorder.Top = (pnlHeader.Height - imgSuperorder.Height) / 2   ' Centre SuperOrder vertically.

The log reports
Error loading bitmap: Error opening stream (/private/var/mobile/Containers/Data/Application/E37F0587-E823-4ABA-9C1D-B46ECDCF7ABE/tmp/virtual_assets/superordertexttranssmall.png): Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}
Error occurred on line: 510 (hHome)
Object was not initialized (UIImage)
Stack Trace: (
.
.

Its old code so I am sure I am doing some wrong - Any help would be appreciated.

Kind regards
Dave Morris
 

davemorris

Active Member
Licensed User
Longtime User
Hi, thanks for the response

Sadly clean compile did not work.

I always do a clear compile if I experience strange problems (also find that uninstall and reinstall the App can also help - particularly with UI issues) - in this case neither has worked.

Is the code OK - should I initialize "Dim bt as bitmap" somehow?

Thanks for the input
Kind regards
Dave Morris
 
Upvote 0

davemorris

Active Member
Licensed User
Longtime User
Hi Problem solved.

The compiler warned me about unused graphics files, which I deleted. However one of which was "superordertexttranssmall.png" which is loaded into the ImageView imgSuperorder at design time.

Well I did not get any errors, but I did think the compiler warning was inappropriate and the file should not have been deleted.

Reinstated the graphic file "superordertexttranssmall.png" and it all appears to work - Hopefully the fix is correct with a full release version!

Kind regards
Dave Morris
 
Upvote 0
Top