更新到XE2 Update 2后,Delphi / FPC代码不再在XCode下编译

时间:2011-11-04 04:09:07

标签: ios xcode web-services delphi fpc

我使用Delphi XE2(Firemonkey)编写了一个iOS应用程序来调用Web服务。

自从我应用Delphi XE2 Update 2后,代码已停止编译 - (之前我使用的是更新1)。 我还将XCode更新为4.2和iOS5,但是我认为从那时起编译好了(不是100%肯定)。所以我无法自信地将其作为嫌疑人消除。

这是使用FPC在xcode下编译好的代码片段(也很好用!)。我在mac上应用了FPC和Firemonkey XE2更新。

TSynWebServices_iOS = objcclass(NSURLConnection)
private
  reqURL:     NSURL;
  reqPacket:  NSMutableURLRequest;
  webData:    NSMutableData;
public
  function  init: id; override;
  procedure dealloc; override;
  //
  procedure connection_didReceiveResponse(connection: NSURLConnection;
                                          response: NSURLResponse); override;
  procedure connection_didReceiveData(connection: NSURLConnection; data: NSData); override;
  procedure connection_didFailWithError(connection: NSURLConnection; error: NSError); override;
  procedure connectionDidFinishLoading(connection: NSURLConnection); override;
end;

现在我收到以下错误......

SynWebServices_iOS_Unit.pas(44,15) Error: There is no method in an ancestor class to be overridden: "TSynWebServices_iOS.connection_didReceiveResponse(NSURLConnection,NSURLResponse);"
SynWebServices_iOS_Unit.pas(46,15) Error: There is no method in an ancestor class to be overridden: "TSynWebServices_iOS.connection_didReceiveData(NSURLConnection,NSData);"
SynWebServices_iOS_Unit.pas(47,15) Error: There is no method in an ancestor class to be overridden: "TSynWebServices_iOS.connection_didFailWithError(NSURLConnection,NSError);"
SynWebServices_iOS_Unit.pas(48,15) Error: There is no method in an ancestor class to be overridden: "TSynWebServices_iOS.connectionDidFinishLoading(NSURLConnection);"
SynWebServices_iOS_Unit.pas(44,15) Error: Objective-C messages require their Objective-C selector name to be specified using the "message" directive.
SynWebServices_iOS_Unit.pas(44,15) Error: Mismatch between number of declared parameters and number of colons in message string.
SynWebServices_iOS_Unit.pas(46,15) Error: Mismatch between number of declared parameters and number of colons in message string.
SynWebServices_iOS_Unit.pas(47,15) Error: Mismatch between number of declared parameters and number of colons in message string.
SynWebServices_iOS_Unit.pas(48,15) Error: Mismatch between number of declared parameters and number of colons in message string.
SynWebServices_iOS_Unit.pas(56,1) Fatal: There were 9 errors compiling module, stopping
Fatal: Compilation aborted

查看看似FPC的包含文件 - 'NSURLConnection.inc' - 这些方法没有为NSURLConnection定义,但它们是为NSURLConnectionDelegateCategory类定义的。

但是,如果我尝试继承NSURLConnectionDelegateCategory,则无法识别该类。

是否有其他人遇到此问题,或设法在XE2更新2下使用NSURLConnection?

由于

1 个答案:

答案 0 :(得分:0)

这个问题已在这里得到解答......(方法已经移动)

https://forums.codegear.com/thread.jspa?threadID=63537&tstart=0