我已经使用Delphi XE2(Firemonkey)编写了一个iOS应用程序来调用Web服务。
自从我应用Delphi XE2 Update 2-(以前我使用Update 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?
谢谢
最佳答案
这个问题已经在这里回答了...(方法已经移动)
https://forums.codegear.com/thread.jspa?threadID=63537&tstart=0
关于ios - 更新到XE2 Update 2后,Delphi/FPC代码不再在XCode下编译,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8004787/