I have written an iOS app using Delphi XE2 (Firemonkey) to call a webservice.
The code has stopped compiling since I applied Delphi XE2 Update 2 - (Previously I was using update 1). I have also updated the XCode to 4.2 and iOS5, however I think that have compiled okay since then (not 100% sure). So I cannot confidently eliminate it as a suspect.
This is the code fragment that previously compiled ok (and worked nicely too!) under xcode using FPC. I have applied the FPC and Firemonkey XE2 updates on the mac.
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;
Now I am getting the following errors...
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
Looking at what appears to be the include file for FPC - 'NSURLConnection.inc' - these methods are not defined for NSURLConnection, however they are defined for the class NSURLConnectionDelegateCategory.
If I try to inherit from NSURLConnectionDelegateCategory instead however, the class is not recognised.
Has anyone else encountered this issue, or managed to use NSURLConnection under XE2 update 2?
Thanks