简体   繁体   English

RAD XE2 DataSnap-iOS的Objective-C中的调用方法

[英]RAD XE2 DataSnap - Calling methods In Objective-C for iOS

I've written a DataSnap server in Delphi, and am now writing an iPhone client app in Objective-C to consume it's data. 我已经在Delphi中编写了一个DataSnap服务器,现在在Objective-C中编写了一个iPhone客户端应用程序来使用它的数据。 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. “ ReverseString”方法应返回文本“ eybdooG”,但仅返回空白,而且我在DataSnap服务器端看不到任何连接活动-好像根本就没有调用该方法。 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. 有趣的是,如果我未设置DSRESTConnection的UserName和Password属性,则它会尝试连接到服务器,并且可以看到该活动,但是连接失败并显示“ 401:Unauthorized”,因为我的DataSnap服务器需要用户凭据。

Has anybody successfully connected to a DataSnap server with Objective-C, either with or without user credentials? 是否有人通过或不通过用户凭证成功连接到具有Objective-C的DataSnap服务器?

Apologies if I've missed something obvious, only been using Xcode for 2 days so still finding my feet. 抱歉,如果我错过了明显的事情,只使用Xcode 2天,所以仍然可以找我的脚。

Just to update this - Embarcadero have confirmed this as a bug in the iOS DataSnap framework and have fixed it. 只是为了更新此内容-Embarcadero已确认这是iOS DataSnap框架中的错误并已修复。 The bug was in DSRESTConnection.m and there is a new fixed version in their sourceforge repository here : 该错误位于DSRESTConnection.m中,其sourceforge存储库中有一个新的固定版本:

http://radstudiodemos.svn.sourceforge.net/viewvc/radstudiodemos/branches/RadStudio_XE2/Delphi/DataSnap/connectors/ http://radstudiodemos.svn.sourceforge.net/viewvc/radstudiodemos/branches/RadStudio_XE2/Delphi/DataSnap/connectors/

Jonathan 乔纳森

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM