[Pyobjc-dev] Using NSURLConnection
Brought to you by:
ronaldoussoren
From: David R. <da...@it...> - 2004-03-27 21:08:04
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I've tried to use NSURLConnection to load a resource from a URL, but very strange things happen when the framework tries to call my delegate. This is some code from my project: def startReadingFromURL( self, url ): self.waitingForDataFromURL = True nsurl = NSURL.URLWithString_(url) request = NSURLRequest.requestWithURL_(nsurl) connection = NSURLConnection.connectionWithRequest_delegate_( request, self ) def connection_didReceiveData_(self, connection, data): print str(data) When this runs, the program crashes just as it is supposed to call connection_didReceiveData_. The backtrace is a stack overflow due to recursion, and it looks like this: 0 libobjc.A.dylib 0x90835cd0 -[Protocol descriptionForInstanceMethod:] + 0x10 1 com.apple.Foundation 0x909fe5a0 _NSMethodDescriptionForSelector + 0x84 2 com.apple.Foundation 0x90a491e0 -[NSInvocationBuilder forward::] + 0x38 3 libobjc.A.dylib 0x90836810 _objc_msgForward + 0xb0 4 com.apple.Foundation 0x90a4db88 -[NSProxy respondsToSelector:] + 0x50 5 _objc.so 0x002836c0 -[OC_PythonObject respondsToSelector:] + 0x40 6 com.apple.Foundation 0x909fafec _NSDescriptionWithLocaleFunc + 0x48 7 com.apple.CoreFoundation 0x9019ed9c _CFStringAppendFormatAndArgumentsAux + 0xfdc 8 com.apple.CoreFoundation 0x901a4b04 _CFStringCreateWithFormatAndArgumentsAux + 0x90 9 com.apple.Foundation 0x90a50bd4 +[NSException raise:format:arguments:] + 0x5c 10 com.apple.Foundation 0x90a5cd5c +[NSException raise:format:] + 0x2c 11 _objc.so 0x00283c08 -[OC_PythonObject forwardInvocation:] + 0x1e0 12 com.apple.Foundation 0x90a4dbb0 -[NSProxy respondsToSelector:] + 0x78 13 _objc.so 0x002836c0 -[OC_PythonObject respondsToSelector:] + 0x40 ... ... ... 502 com.apple.Foundation 0x909fafec _NSDescriptionWithLocaleFunc + 0x48 503 com.apple.CoreFoundation 0x9019ed9c _CFStringAppendFormatAndArgumentsAux + 0xfdc 504 com.apple.CoreFoundation 0x901a4b04 _CFStringCreateWithFormatAndArgumentsAux + 0x90 505 com.apple.Foundation 0x90a50bd4 +[NSException raise:format:arguments:] + 0x5c 506 com.apple.Foundation 0x90a5cd5c +[NSException raise:format:] + 0x2c 507 _objc.so 0x00283c08 -[OC_PythonObject forwardInvocation:] + 0x1e0 508 com.apple.Foundation 0x90a4dbb0 -[NSProxy respondsToSelector:] + 0x78 I don't know what to do to make this work. Callbacks in general have proven slightly shaky for me -- I think I have missed some critical information. / Regards, David Remahl - --- PGP key information--- pub 1024D/ 87256085 2003/06/12 David Remahl <da...@re...> Web: http://ittpoi.com/david_remahl.asc Fingerprint: 0C38 293C 86A9 7756 9CEA 4ED6 1651 620E 8725 6085 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (Darwin) iD8DBQFAZe0jFlFiDoclYIURAt0EAJ9rVVsaI77ML0vmC6XWsIHBLVAB1ACeLPnk rQazJlszNt+YyshoREiVr2k= =R1Yk -----END PGP SIGNATURE----- |