【发布时间】:2011-11-04 04:09:07
【问题描述】:
我使用 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 update 2 下使用 NSURLConnection?
谢谢
【问题讨论】:
-
您是否在两个源代码树之间进行了区分?
-
我的来源没有改变。唯一改变的是编译器版本和它附带的任何东西。这不受源代码控制。
标签: ios xcode web-services delphi fpc