RAD XE2 DataSnap - Calling methods In Objective-C for iOS
-
26-10-2019 - |
Question
I've written a DataSnap server in Delphi, and am now writing an iPhone client app in Objective-C to consume it's data. I'm starting simple by just calling a simple method to return a string - see code :
NSString *sReverseStr;
DSRESTConnection *connDSREST;
TServerMethods *dsClient;
connDSREST = [[DSRESTConnection alloc] initWithDelegate:self];
[connDSREST setHost:@"192.168.0.19"];
[connDSREST setPort:80];
[connDSREST setProtocol:@"http"];
[connDSREST setUserName:@"user"];
[connDSREST setPassword:@"pass"];
dsClient = [[TServerMethods alloc] initWithConnection:connDSREST];
sReverseStr = [dsClient ReverseString:@"Goodbye"];
The 'ReverseString' method should return the text 'eybdooG' but it just returns blank, and I don't see any connection activity on the DataSnap server side - it's as if the method isn't being called at all. Interestingly, if I don't set the UserName and Password properties of the DSRESTConnection then it does try to connect to the server and I can see the activity, but the connection fails with '401: Unauthorised' because my DataSnap server requires user credentials.
Has anybody successfully connected to a DataSnap server with Objective-C, either with or without user credentials?
Apologies if I've missed something obvious, only been using Xcode for 2 days so still finding my feet.
Solution
Just to update this - Embarcadero have confirmed this as a bug in the iOS DataSnap framework and have fixed it. The bug was in DSRESTConnection.m and there is a new fixed version in their sourceforge repository here :
Jonathan