API 1 to API 2 conversion Memoryblock issue

The following code works in an API 1 version of a project, where the RS recordset, the Foto field contains a Blob;

var picMB as MemoryBlock
picMB=RS.Field(“Foto”).NativeValue
pic=iOSImage.FromData(picMB)
ImageView1.Image=pic

I’m now converting the project to API 2 using this code:

var picMB as MemoryBlock
picMB=RS.Field(“Foto”).NativeValue
pic=Picture.FromData(picMB)
ImageView1.Image=pic

and get the following error;

Parameter “Data” expects class MemoryBlock, but this is class Xojo.Core.MemoryBlock

in the FromData line.

Does the RS.Field(“Foto”).NativeValue line automatically create a MemoryBlock instead of a Xojo.Core.MemoryBlock?

Should I convert the MemoryBlock?

Try to set “Simple References” in the Inspector of “Shared Build Settings”.

That setting is no longer available and is considered off by default on Xojo 2020R2.1.
The process of converting a project from API1 to API2 is far from painless.

1 Like

I have the same problem with the last Xojo version ( 2021r1.1) and in this version there isn’t a Simple References settings.

How can i solve this problem?

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.