Several questions migrating DA from java to cocoa


(DonaldShimoda) #1

In each case i post java code and my try on cocoa code(not working)

How to setup a proxy service?

  fDataService := new NewLibrary.DataService_Proxy(;
  //(fDataService.ProxyMessage as BinMessage).UseCompression       := true;
  (fDataService.ProxyClientChannel as HttpClientChannel).Timeout := 5000;
  (fDataService.ProxyMessage as BinMessage).Envelopes.put('AES', aesEnvelope);
   fDataService.ProxyClientChannel.ChannelCallback := new interface ClientChannel.IClientChannelCallback(
    clientChannelNeedsLogin := method(anException: Exception)
      System.out.println("SessionNotFoundException was thrown");
      exit true;
    requestFailWithException := method(anException: Exception)
      //Connected := False;
      doMessageShow('DataService requestFailWithException ' + anException.Message, false);
  // ver si puedo usar directamente el adapter con cast
  fDataService := new NewLibrary.DataService_Proxy(adapter_serverUrl);

trying to get datatables in a call

var tableNames := new NSMutableArray<String>;

  var tables := DataAdapter.getDataTables(tableNames);

get this message

Error dispatching message: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

building a where condition

    var lCondition :BinaryExpression :=
        new BinaryExpression(
          new BinaryExpression(
            new BinaryExpression(
              new FieldExpression(fld_empresas_empresaglobalkey),
              new ConstantExpression(fDataAccess.adapter_loginCompany),
            new BinaryExpression(
              new FieldExpression(fld_personas_usuario),
              new ConstantExpression(fDataAccess.adapter_loginName),
        new BinaryExpression(
          new FieldExpression(fld_hardware_device_serie_imei),
          new ConstantExpression(fDataAccess.adapter_loginIMEI),

Thats all.

Thanks in advance!

(antonk) #2


This is a platform (iOS) thing not direcly related to DA. Please take a look at for more details.


(DonaldShimoda) #3

Thanks for your help, but i dont undesrtand. Seems like the conenction is made in an insecure form. Is not related to remobejcts channel? I build an IOS client, using Delphi + DA, IOS 10 and never see that message, over the same server. Then i think some is misconfigurated on Fire? Sorry, i think i need a more deeper information here about how to configure my remobjects channel.

Best regards.
P.S. Please if can ask the other stuff?

(antonk) #4

Ih you are using Url like http://... (not https://...) then the connection is not secure by definition.

If in this case Delphi-built app doesn’t warn you then ( IMHO ) this is actually a security flaw and a kind of violation of Apple requirements (ones that require all apps to use https for connections). Most probably Delphi app just have the override option enabled by default.

(DonaldShimoda) #5

Ok, delphi fault as usual. How to fix that then? Must i put a security certficate on the server? Can please explain that?

(marc hoffman) #6

Apple require all communication to go via TSL1.2 or later. You must switch your server to use https:. As a workaround you can add this to your Info.plist file, but you may nit be able to submit the app to the store with that, in there future:


(DonaldShimoda) #7

Thanks for the clarification.

(marc hoffman) #8

FWIW, the same would apply to a Delphi app, but it’d not be shocked to hear that Delphi just adds the above to your Plist automatically (which would be really, really bad, but…)


(DonaldShimoda) #9

Marc, the strange stuff here is i submitted delphi ios app to the apple store, not complain at all.

Best regards.

(marc hoffman) #10

Apple is not enforcing this 100% yet.

But that means Delphi most likely did add that setting for you secretly. The mind boggles. But then, DataSnap also opens a pass-thru connection to your database to the client, and they call out “secure multi-tier”, so what do i expect… :stuck_out_tongue_winking_eye:

(DonaldShimoda) #11

Sorry for ask again. Can help my explaining how to migrtae taht code from java to cocoa?

Thanks in advance.

(DonaldShimoda) #12

Need URGENT help with that please. Theres no documentation or samples covering this case.


(antonk) #13

Please explain what you are trying to achieve

(DonaldShimoda) #14

Connect to a Remobjects service and call a method, same the java code do, but in IOS. See the java code.

Best regards.

(antonk) #15

Did you lokk at the c:\Users\Public\Documents\RemObjects Samples\RemObjects SDK for Java folder?

“c:\Users\Public\Documents\RemObjects Samples\RemObjects SDK for Java\Oxygene\HTTP Chat\Program.pas”

F.e. the file c:\Users\Public\Documents\RemObjects Samples\RemObjects SDK for Java\Oxygene\Mega Demo\UserInterface.pas:

method DemoWindow.initDemoProxy;
  var lProtocol: String := protocolBox.SelectedItem as String;
  var lHost: String := hostField.Text as String;
  var lPort: String := portSpinner.Text as String;
  var lMessageType: String := '/';
  if binaryRbtn.isSelected then
    lMessageType := '/bin';
  var lURI := new URI(lProtocol + '://' + lHost + ':' + lPort + lMessageType);
  MegaDemoService := new MegaDemoService_Proxy(lURI);
  if useCompession.isSelected then
    (MegaDemoService.ProxyMessage as BinMessage).UseCompression := true
    (MegaDemoService.ProxyMessage as BinMessage).UseCompression := false;
  (MegaDemoService.ProxyClientChannel as HttpClientChannel).Timeout := 1000;

Similar code in the MegaDemo Android sample:

var lURI := new URI("");
fService := new MegaDemoService_Proxy(lURI);
(fService.ProxyMessage as BinMessage).UseCompression := true;
(fService.ProxyClientChannel as HttpClientChannel).Timeout := 1000;


(DonaldShimoda) #16

No, sorry, i dont. I start in the bad path thinking syntaxis for RO and DA are the same on all platforms. I will check every sample for IOS now.

Best regards.

(antonk) #17

There is a good reason why the syntax differs:
The code you write is compiled directly into platform-native code, without a massive overhead of some runtime library that hides platform-specific stuff.
From one side, it requires you to write more code, from other it gives beter performance more native apps. Also it allows to use platform-specific tutorials to do the things needed (f.e. you want ot use https with self-signed certificate on Android and just found some code on StackOverflow. You can oxidize that code and it will work fo you in your app)

(DonaldShimoda) #18

I have to disagree. That forces to wrote all the code two or tree times to do the same. In any case, as i talk with marc, will be better if you offer a common wrapper and let the use to decide if use native code or the common wrappers, and not force to write a lot of code. is a manintenance nigthmare, despite the aditional time to get it working.

Best regards.

(marc hoffman) #19

As i explained before, DA/.NET and DA/Cocoa were written LONG before there was Elements support for Java and Cocoa. They were design dot fit in well with each respective platform because there WAS no way to share code anyways (Android apps would have been in Java, Cocoa apps in Objective-C).

We ARE looking into a better approach in the future, but for now, thats what it is.

(DonaldShimoda) #20

Thank you marc, will be a better approach without any doubt.

Best regards.

Examples on how to use Fire with C# Oxygen to iOS to a Relativity server