I'm trying to use NSURLConnection, mainly to take advantage of Apple's built
in proxy detection. However I cannot get the delegate to work.
Any help in getting NSURLConnection to work would be greatly appreciated.
NSURLConnection.Class.cs defines:
public virtual Id Delegate
{
get { return ObjectiveCRuntime.SendMessage<Id>(this,
"delegate"); }
set { ObjectiveCRuntime.SendMessage(this, "setDelegate:",
value); }
}
However there is no "delegate" selector defined on NSURLConnection so
SetDelegate fails with:
2009-11-14 10:50:12.468 SimplePrototype[1356:5e03] -[NSURLConnection
delegate]: unrecognized selector sent to instance 0x6d3b20
Also if I try:
NSURLConnection.NSURLConnectionEventDispatcher d = new
NSURLConnection.NSURLConnectionEventDispatcher();
d.ConnectionDidFailWithError += new
NSURLConnection.ConnectionDidFailWithErrorEventHandler(d_ConnectionDidFailWithError);
d.ConnectionDidFinishLoading += new
NSURLConnection.ConnectionDidFinishLoadingEventHandler(d_ConnectionDidFinishLoading);
d.ConnectionDidReceiveData += new
NSURLConnection.ConnectionDidReceiveDataEventHandler(d_ConnectionDidReceiveData);
d.ConnectionDidReceiveResponse += new
NSURLConnection.ConnectionDidReceiveResponseEventHandler(d_ConnectionDidReceiveResponse);
NSURLConnection conn = new NSURLConnection(req, d);
none of the callbacks are invoked. I also tried creating a class that
defined:
[ObjectiveCMessage("connection:didReceiveResponse:")]
public void didReceiveResponse(NSURLConnection conn, NSURLResponse
resp)
but that failed to receive a response either. I also tried creating the
connection with start immediately false and then calling start, again
without success.
Thanks,
Duane