Remobjects RTL in XCode projects , can I and how to use properly?

Hi,
I made in Fire static IOS library which I added to XCode project.
Which static library should I add to XCode project (I added libToffee, libElements) and my static library.
In my static library I used

Remobjects.Elements.RTL.Convert.ToBase64String(vNagl.ToByteArray,0,vNagl.length )

and here I have some strange behavior
Calling this line crashes my APP , when I changed it to native code NSData and NSString used to made BASE64 all works fine …

Important information is that when i use this library in Oxygene Fire project code is working fine with RTL.Convert.

Did I miss something?

Best regards
Mateusz

make sure you have -ObjC set in the linker flags in Xcode. For some reason, that is not the default for Xcode (anymore?), and Objective-C categories/extension methods seem to break, when this is not set.

Elements passes this flag by default when linking your executable.

1 Like

Hi,
Another problem is when I used JSON from RTL in my static library and added import file to bridger header for SWIFT I got error :

*@property (strong) __RemObjects_Elements_RTL_JsonDocument DokumentJSON;

unknown type name ‘__RemObjects_Elements_RTL_JsonDocument’; did you mean ‘__RemObjects_Elements_RTL_MessageDigest’?

Did I miss something ? I have added as I wrote before libtoffee , libElements
What should I do to run it ??

Best regards
Mateusz

You need to import Elements.h. the problem is, right now Elements.h has some stuff that Xcode/Objective-C does not like and tyou might need to manually review/remove. We have an issue logged to resolve this.

Workarounds:

(a) manually clean Elements.h
or
(b) don’t expose any public APIs that use Elements RTL types to Xcode; only use Elements RTL internally. I realize that is easier said than done.

Logged as bugs://E26903.

Hi,
Where is located elements.h ? I set option generate .h file but when I compile it I have only .fx and .a files as output results for Elements, for my static lib i have all files.

Mateusz

Hmm it looks like we don’t ship this file; if you manually rebuild Elements RTL from source (GitHub - remobjects/RTL2: Next Generation RTL for Elements — replaces Sugar.), you should get the .h.

I did it as I wrote I don’t have it. I have only .a and .fx files.
Option generate .h files is set to true.

Ah sorry, missed that.

Weird, i get it generated fine, here:

            -> Task RemObjects.EBuild.Elements.ElementsCopyFinalOutput started for Elements.RTL.Toffee.macOS.
D:             Copying to /Users/mh/Code/RemObjects/RTL2/Source/bin/Debug/macOS
D:             Generated Files for 'Elements.RTL.Toffee.macOS' target 'Toffee-macOS':
D:               Elements.h (/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/Elements.RTL.Toffee.macOS-0D96137F3E72C8EDFCEBCEFB73C4C0C272AB4C7E/Debug/Toffee-macOS/Device/arm64/Elements.h)
D:               libElements.a (/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/Elements.RTL.Toffee.macOS-0D96137F3E72C8EDFCEBCEFB73C4C0C272AB4C7E/Debug/Toffee-macOS/Device/libElements.a)
D:               libElements.fx (/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/Elements.RTL.Toffee.macOS-0D96137F3E72C8EDFCEBCEFB73C4C0C272AB4C7E/Debug/Toffee-macOS/Device/libElements.fx)
               Final Output for 'Elements.RTL.Toffee.macOS' target 'Toffee-macOS':
                 Elements.h (/Users/mh/Code/RemObjects/RTL2/Source/bin/Debug/macOS/Elements.h)
                 libElements.a (/Users/mh/Code/RemObjects/RTL2/Source/bin/Debug/macOS/libElements.a)
                 libElements.fx (/Users/mh/Code/RemObjects/RTL2/Source/bin/Debug/macOS/libElements.fx)
               Final Output for Referencing:
                 libElements (/Users/mh/Library/Application Support/RemObjects Software/EBuild/Obj/Elements.RTL.Toffee.macOS-0D96137F3E72C8EDFCEBCEFB73C4C0C272AB4C7E/Debug/Toffee-macOS/Device/libElements.fx), Toffee-macOS
            <- Task RemObjects.EBuild.Elements.ElementsCopyFinalOutput finished for Elements.RTL.Toffee.macOS, took 0.0120s (8.631s).

which project and (sub)platform are you building?

I tried with MAC and IOS …
Have you got it in final output folder or only in temporary (eBuild) ?

in both:

Can you send me these files as a temporary workaround ?

sure…

macOS: Elements.h (114.9 KB)
iOS: Elements.h (111.1 KB)

one thing you’ll want add to the file solve a bulk of errors is typedef NSString PlatformString.

Should I change it ?
Can you give me example ?

literally add

typedef NSString PlatformString;

to the top.

As for the other fixes needed, you’d have to go thru them one by one and maybe remove the lines you don’t need. The issue above is logged to fix these, but if I had a fixed version handy right now myself, we’d not be having this talk ;).

Ok. I understand :slight_smile: