Re: Crash from NSURLConnection if delegate released too soon?

2014-08-27 Thread howard
I’m not entirely sure this crash is down to you nor that it’s calling any methods on your correctly deallocated instance of NSURLConnection or the delegate. To me it looks like the HTTP cache subsystem is purging data and tripping over itself because of something it cleaned up when the

Re: Crash from NSURLConnection if delegate released too soon?

2014-08-25 Thread Roland King
, not > making it a member at all. > > Regards, > Howard That didn’t sound quite right, either way Jens followed up with some rules which did sound right. I’m not entirely sure this crash is down to you nor that it’s calling any methods on your correctly deallocated instanc

Re: Crash from NSURLConnection if delegate released too soon?

2014-08-25 Thread Howard Moon
ngs that I alloc (or copy). I don't have any problems with other Cocoa classes I'm using. The only issue seems to be this NSURLConnection object. And what's been confusing me is apparently this mixing of examples using ARC and not. > Have you run the static analyzer (C

Re: Crash from NSURLConnection if delegate released too soon?

2014-08-25 Thread Jens Alfke
> On Aug 25, 2014, at 1:43 PM, Howard Moon wrote: > > The Apple docs show simply setting the connection and receivedData to nil, > instead of calling release on them. Do you have a strong [sic] reason to be using manual retain/release? If not, I'd _really_ recommend switching to ARC, at leas

Re: Crash from NSURLConnection if delegate released too soon?

2014-08-25 Thread Howard Moon
inishLoading, not >> making it a member at all. > > It should be OK either way as long as you're following the ref-counting rules > (or are using ARC.) > * Only release the NSURLConnection if you allocated it by calling +alloc > * Don't release the NSURLConnect

Re: Crash from NSURLConnection if delegate released too soon?

2014-08-25 Thread Jens Alfke
, not > making it a member at all. It should be OK either way as long as you're following the ref-counting rules (or are using ARC.) * Only release the NSURLConnection if you allocated it by calling +alloc * Don't release the NSURLConnection instance passed into your delegate me

Re: Crash from NSURLConnection if delegate released too soon?

2014-08-25 Thread Howard Moon
operly, > why would the order matter so much? If the system released an object because > its reference count went to 0, and then *I* released it, wouldn't it cause a > crash that way, as well? > > I'm really stumped as to where to look. > > -Howard > > > On

Re: Crash from NSURLConnection if delegate released too soon?

2014-08-25 Thread Howard Moon
ence count went to 0, and then *I* released it, wouldn't it cause a crash that way, as well? I'm really stumped as to where to look. -Howard On Aug 25, 2014, at 8:15 AM, Howard Moon wrote: > Hi, > > I've got an NSURLConnection owned by an NSObject that implements

Crash from NSURLConnection if delegate released too soon?

2014-08-25 Thread Howard Moon
Hi, I've got an NSURLConnection owned by an NSObject that implements the NSURLConnectionDelegate protocol, used by a C++ object inside an AudioUnits plug-in. I'm seeing a crash occur if I close the plug-in (and thus call dealloc on the delegate object). The crash happe

Re: NSURLConnection and 404

2013-06-09 Thread Koen van der Drift
On Jun 9, 2013, at 5:54 AM, Jean-Daniel Dupas wrote: > The NSConnectionDelegate protocol has a method that pass you the response: > > - (void)connection:(NSURLConnection *)connection > didReceiveResponse:(NSURLResponse *)response > > You can test if the response is of type

Re: NSURLConnection and 404

2013-06-09 Thread Gerriet M. Denkmann
ist/or/not.gif >> data = [ NSData dataWithContentsOfURL: url options: mask error: &outError ]; >> >> So I am trying to use NSURLConnection instead. Also works fine. >> >> Only: if my url does not exist, then the old method returned data = nil. >> Very good. >&g

Re: NSURLConnection and 404

2013-06-09 Thread Jean-Daniel Dupas
ror ]; > > So I am trying to use NSURLConnection instead. Also works fine. > > Only: if my url does not exist, then the old method returned data = nil. Very > good. > > Using NSURLConnection I always get some answer - either image data or a > lengthy

Re: NSURLConnection and 404

2013-06-09 Thread Koen van der Drift
On Jun 9, 2013, at 5:35 AM, Gerriet M. Denkmann wrote: > Is there a way to get just the status (in this case 404) without parsing the > data? > I looked at the NSURLConnection delegate methods, but did not find anything > which looked appropriate. I do something like th

NSURLConnection and 404

2013-06-09 Thread Gerriet M. Denkmann
This works fine, but blocks my for 1 sec on a good day - who know how long if the net is slow: url = something/which/might/exist/or/not.gif data = [ NSData dataWithContentsOfURL: url options: mask error: &outError ]; So I am trying to use NSURLConnection instead. Also works fine. Only: i

Re: Service with NSURLConnection

2013-01-11 Thread Uli Kusterer
On 11.01.2013, at 20:45, Jens Alfke wrote: > Then you’ll need to block the main thread until the background thread > finishes its work. You could use an NSConditionLock to do that — main thread > creates the lock and locks it, passes the lock to the background thread, then > blocks waiting for

Re: Service with NSURLConnection

2013-01-11 Thread Jens Alfke
On Jan 11, 2013, at 11:09 AM, Jim Thomason wrote: > For sake of argument, assume that the work has to be done in an external > thread, or I have to jump in and out of the main thread some how. I'm not > actually using URL connections like this in the actual app, I was just hoping > that it wa

Re: Service with NSURLConnection

2013-01-11 Thread Jim Thomason
: method seems to only let > me write to the pasteboard during the invocation of that method, and once > it completes I'm done. NSURLConnection is all delegate based, so I wouldn't > have the results of my lookup until the secondary thread completes and my > delegate

Re: Service with NSURLConnection

2013-01-11 Thread Jens Alfke
On Jan 11, 2013, at 8:59 AM, Jim Thomason wrote: > The issue is that my -doWebStuff:userData:error: method seems to only let > me write to the pasteboard during the invocation of that method, and once > it completes I'm done. NSURLConnection is all delegate based, so I would

Re: Service with NSURLConnection

2013-01-11 Thread Jim Thomason
thing and pastes back into place "An > > awesome computer company and/or fruit". No, I don't know why anyone would > > want such a service, this is just to illustrate the concept. > > > > The issue is that my -doWebStuff:userData:error: method seems to only let > > me write to

Re: Service with NSURLConnection

2013-01-11 Thread Alex Zavatone
nt such a service, this is just to illustrate the concept. > > The issue is that my -doWebStuff:userData:error: method seems to only let > me write to the pasteboard during the invocation of that method, and once > it completes I'm done. NSURLConnection is all delegate based, so I wouldn'

Service with NSURLConnection

2013-01-11 Thread Jim Thomason
computer company and/or fruit". No, I don't know why anyone would want such a service, this is just to illustrate the concept. The issue is that my -doWebStuff:userData:error: method seems to only let me write to the pasteboard during the invocation of that method, and once it complete

Re: NSURLConnection working OK on iOS 6?

2012-10-05 Thread Roger Dalal
Laurent: We are definitely seeing more issues with NSURLConnection on iOS 6. In particular, it seems that iOS 6 re-establishes data connectivity a little bit slower than before, especially from a locked state. Because our team had not implemented data connectivity (Reachability) tests exactly

Re: NSURLConnection working OK on iOS 6?

2012-10-04 Thread Alex Kac
I seem to have gotten an uptick of HTTP Too many Redirects. I don't know if its yet iOS 6 or just so many people upgrading that the servers are wonky (Google API servers we use mostly). On Oct 3, 2012, at 6:23 PM, Laurent Daudelin wrote: > Anybody extensively using NSURLConnectio

NSURLConnection working OK on iOS 6?

2012-10-03 Thread Laurent Daudelin
Anybody extensively using NSURLConnection seeing more failure with timed outs with devices running on iOS 6? -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/ Logiciels Nemesys Software

Re: NSURLConnection and MVC

2012-09-19 Thread Graham Cox
link, lots of info there. Unfortunately he doesn't > discuss the responsibility of the MVC classes in the slides regarding > the best location for the NSURLConnection code. I got that and the > paring already working, but need to ma

Re: NSURLConnection and MVC

2012-09-19 Thread Jens Alfke
On Sep 19, 2012, at 12:14 PM, Koen van der Drift wrote: > Thanks for the link, lots of info there. Unfortunately he doesn't > discuss the responsibility of the MVC classes in the slides regarding > the best location for the NSURLConnection code. I got that and the > paring alr

Re: NSURLConnection and MVC

2012-09-19 Thread Koen van der Drift
Thanks for the link, lots of info there. Unfortunately he doesn't discuss the responsibility of the MVC classes in the slides regarding the best location for the NSURLConnection code. I got that and the paring already working, but need to make it more flexible. - Koen. On Wed, Sep 19, 2012

Re: NSURLConnection and MVC

2012-09-19 Thread Chuck Soper
p://www.mactech.com/conference/presentations-speaker The implementation details start around page 26. Chuck On 9/19/12 6:42 AM, "Koen van der Drift" wrote: >Briefly in my app (OSX), I download data from a database to be >displayed in a view. I created a Controller that takes care of the &

NSURLConnection and MVC

2012-09-19 Thread Koen van der Drift
Briefly in my app (OSX), I download data from a database to be displayed in a view. I created a Controller that takes care of the NSURLConnection, retrieves the data, and sends it to a database model class to parse. It also takes care of updating the UI during the download ("Download in pro

Re: Canceling a NSURLConnection

2012-04-25 Thread Andreas Grosam
On Apr 25, 2012, at 9:45 AM, Andreas Grosam wrote: > Hi All! > > I'm having an issue how to properly and reliably canceling a NSURLConnection > scheduled on a secondary thread and would really appreciate help. > > > The actual issue is that sometimes (not always)

Canceling a NSURLConnection

2012-04-25 Thread Andreas Grosam
Hi All! I'm having an issue how to properly and reliably canceling a NSURLConnection scheduled on a secondary thread and would really appreciate help. The actual issue is that sometimes (not always) sending a message from the main thread - which is basically a higher level cancel message

Re: asynchronous nsurlconnection in nsoperation

2012-03-23 Thread Andreas Grosam
On Mar 23, 2012, at 11:25 AM, Steve Sisak wrote: > At 6:59 PM +0300 3/21/12, Ariel Feinerman wrote: >> I wish to insert an asynchronous NSURLConnection into non-concurrent >> NSOperation the reason is to allow necessarily unarchive actions on the >> streaming date so &g

Re: asynchronous nsurlconnection in nsoperation

2012-03-23 Thread Steve Sisak
At 6:59 PM +0300 3/21/12, Ariel Feinerman wrote: I wish to insert an asynchronous NSURLConnection into non-concurrent NSOperation the reason is to allow necessarily unarchive actions on the streaming date so Look at (and steal code from) the LinkedImageFetcher sample: <h

Re: asynchronous nsurlconnection in nsoperation

2012-03-23 Thread Ariel Feinerman
wrote: > > > Hi, > > > I wish to insert an asynchronous NSURLConnection into non-concurrent > > NSOperation > > the reason is to allow necessarily unarchive actions on the streaming > date > > > Is this for iOS or Mac OS? > > This for iOS > &

Re: asynchronous nsurlconnection in nsoperation

2012-03-22 Thread Andreas Grosam
On Mar 21, 2012, at 4:59 PM, Ariel Feinerman wrote: > Hi, > I wish to insert an asynchronous NSURLConnection into non-concurrent > NSOperation > the reason is to allow necessarily unarchive actions on the streaming date > Is this for iOS or Mac OS? > This for iOS > >

Re: asynchronous nsurlconnection in nsoperation

2012-03-22 Thread Ariel Feinerman
, 2012 at 10:36 PM, Sebastian Celis wrote: > On Wed, Mar 21, 2012 at 10:59 AM, Ariel Feinerman > wrote: > > I wish to insert an asynchronous NSURLConnection into non-concurrent > > NSOperation > > Hi Ariel, > > MBRequest does this. It is done by forcing the operation&#

Re: asynchronous nsurlconnection in nsoperation

2012-03-21 Thread Sebastian Celis
On Wed, Mar 21, 2012 at 10:59 AM, Ariel Feinerman wrote: > I wish to insert an asynchronous NSURLConnection into non-concurrent > NSOperation Hi Ariel, MBRequest does this. It is done by forcing the operation's runloop to continue running while the network connection is in progre

Re: asynchronous nsurlconnection in nsoperation

2012-03-21 Thread Alex Zavatone
Is this for iOS or Mac OS? I've used Grand Central Dispatch and [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]; The second example is synchronous. There is also: NSData *response_NSData = [NSURLConnection sendSynchronousRequest:my_NSURLRequest returningRes

asynchronous nsurlconnection in nsoperation

2012-03-21 Thread Ariel Feinerman
Hi, I wish to insert an asynchronous NSURLConnection into non-concurrent NSOperation the reason is to allow necessarily unarchive actions on the streaming date so - (void) connection: (NSURLConnection *) connection didReceiveData: (NSData*) data { // Append the new data to receivedData

Re: SSL NSURLConnection to fake-cert server?

2012-03-20 Thread Jens Alfke
On Mar 20, 2012, at 11:16 AM, Rick Mann wrote: > I had written a fairly elaborate wrapper around the delegate-based API so I > could use blocks in a way similar to what the new call provides. > It also returned the NSURLConnection object, and allowed canceling of a > request. But I

Re: SSL NSURLConnection to fake-cert server?

2012-03-20 Thread Rick Mann
trol over credentials and certificate trust, you’ll need > to use the delegate API. I had written a fairly elaborate wrapper around the delegate-based API so I could use blocks in a way similar to what the new call provides. It also returned the NSURLConnection object, and allowed canceling of a

Re: SSL NSURLConnection to fake-cert server?

2012-03-20 Thread Jens Alfke
On Mar 19, 2012, at 10:16 PM, Rick Mann wrote: > What do I need to do to? I'm using > -sendAsynchronousRequest:queue:completionHandler: > So I can't set a delegate. If you want more control over credentials and certificate trust, you’ll need to use the delegate API. —Jens

Re: SSL NSURLConnection to fake-cert server?

2012-03-20 Thread Mike Abdullah
Sent from my iPad On 20 Mar 2012, at 05:16 AM, Rick Mann wrote: > I'm connecting to my dev server which has a self-signed cert. When I do this, > NSURLConnection complains with: > > NSLocalizedDescription = "An SSL error has occurred and a secure connection > to

Re: SSL NSURLConnection to fake-cert server?

2012-03-19 Thread Conrad Shultz
that this will cause certs signed by your signing cert to be accepted system-wide. (Sent from my iPhone.) -- Conrad Shultz On Mar 19, 2012, at 22:16, Rick Mann wrote: > I'm connecting to my dev server which has a self-signed cert. When I do this, > NSURLConnectio

SSL NSURLConnection to fake-cert server?

2012-03-19 Thread Rick Mann
I'm connecting to my dev server which has a self-signed cert. When I do this, NSURLConnection complains with: NSLocalizedDescription = "An SSL error has occurred and a secure connection to the server cannot be made."; NSLocalizedRecoverySuggestion = "Would you like to c

NSURLConnection using setDelegateQueue deadlocks

2011-12-19 Thread Michael Link
Is there some trick to getting NSURLConnection to work with an NSOperationQueue on iOS 5, and perhaps Lion but I haven't tried it there? It seems that it causes a deadlock every time just after the last delegate message has been sent (connectionDidFinishLoading:). The project is using ARC.

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread Jens Alfke
On Sep 9, 2011, at 9:10 AM, Andreas Grosam wrote: > One other thing is, using Instruments makes the scenario worse. When > Instruments is connected, the app crashes much sooner due to memory problems. > So, I support my observations on logs, too. That sounds suspicious. You may have memory err

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread Jens Alfke
On Sep 9, 2011, at 6:54 AM, Don Quixote de la Mancha wrote: > I don't know how to fix NSURLConnection, but an alternative would be > to use the source to some other HTTP client. By having the source > code, you would have full control over the buffering. > > For example,

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread Jens Alfke
On Sep 9, 2011, at 4:06 AM, Andreas Grosam wrote: > I'm trying to use a NSURLConnection to download a large data file (>10 MB) > from a web service to the iPhone. Currently, testing on iOS 4.2.1, on a > device. The connection is established over WIFI. > >

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread Andreas Grosam
On Sep 9, 2011, at 6:10 PM, Andreas Grosam wrote: > > I already did this: I meant: - (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse { return nil; } the infamous Copy and Paste

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread Andreas Grosam
On Sep 9, 2011, at 4:15 PM, glenn andreas wrote: > > On Sep 9, 2011, at 6:06 AM, Andreas Grosam wrote: > >> Dir Members, >> >> I'm trying to use a NSURLConnection to download a large data file (>10 MB) >> from a web service to the iPhone. Currently, t

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread Andreas Grosam
On Sep 9, 2011, at 3:59 PM, David Duncan wrote: > On Sep 9, 2011, at 4:06 AM, Andreas Grosam wrote: > >> The problem I get with NSURLConnection is, that it internally uses a lot >> (really a lot) memory for its data buffers. It seems, the connection reads >> as much

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread glenn andreas
On Sep 9, 2011, at 6:06 AM, Andreas Grosam wrote: > Dir Members, > > I'm trying to use a NSURLConnection to download a large data file (>10 MB) > from a web service to the iPhone. Currently, testing on iOS 4.2.1, on a > device. The connection is established over WIFI.

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread David Duncan
On Sep 9, 2011, at 4:06 AM, Andreas Grosam wrote: > The problem I get with NSURLConnection is, that it internally uses a lot > (really a lot) memory for its data buffers. It seems, the connection reads as > much data as it can from the network and a tries to safe it in internal >

Re: NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread Don Quixote de la Mancha
On Fri, Sep 9, 2011 at 4:06 AM, Andreas Grosam wrote: > I'm trying to use a NSURLConnection to download a large data file (>10 MB) > from a web service to the iPhone. Currently, testing on iOS 4.2.1, on a > device. The connection is established over WIFI. > >

NSURLConnection: "Greedy Memory Eater" and Error 303

2011-09-09 Thread Andreas Grosam
Dir Members, I'm trying to use a NSURLConnection to download a large data file (>10 MB) from a web service to the iPhone. Currently, testing on iOS 4.2.1, on a device. The connection is established over WIFI. The problem I get with NSURLConnection is, that it internally uses a lot (

Re: NSURLConnection problem on Mac OS X 10.7

2011-09-08 Thread Jens Alfke
On Sep 8, 2011, at 2:46 AM, Mike Abdullah wrote: >> In delegate connectionDidFinishLoading handling as follows: >> -(void)connectionDidFinishLoading:(NSURLConnection *)connection >> { >> @try { >>CFRunLoopStop(m_runLoopRef); >&

Re: NSURLConnection problem on Mac OS X 10.7

2011-09-08 Thread Mike Abdullah
[m_URLRequest setHTTPBody:[REQUEST_ISSERVICEAVAILABLE > dataUsingEncoding:NSUTF8StringEncoding]]; > > m_connection =[[NSURLConnection > alloc]initWithRequest:m_URLRequest delegate:self]; > > m_runLoop =[NSRunLo

Re: NSURLConnection problem on Mac OS X 10.7

2011-09-08 Thread Jens Alfke
On Sep 8, 2011, at 7:12 AM, Mike Abdullah wrote: >> since we are downloading large data from server so NSURLConnection delegate >> mentioned below is getting called continuously and meanwhile also need to >> update UI, so calling the web service function itself in a saperate

Re: NSURLConnection problem on Mac OS X 10.7

2011-09-08 Thread Mike Abdullah
ownload > {[myWebService makeRequest];} > > since we are downloading large data from server so NSURLConnection delegate > mentioned below is getting called continuously and meanwhile also need to > update UI, so calling the web service function itself in a saperate thread. A

Re: NSURLConnection problem on Mac OS X 10.7

2011-09-07 Thread Mike Abdullah
Show us some code. On 2 Sep 2011, at 14:27, Payal Mundhada wrote: > > Hi All, > > I am making a web service call with NSURLConnection. > > Response is received correctly on Mac OS X 10.5 and Mac OS X 10.6. > > On Mac OS X 10.7, I am getting response as "Bad Req

Fwd: NSURLConnection problem on Mac OS X 10.7

2011-09-06 Thread Payal Mundhada
Hi All, I am making a web service call with NSURLConnection. Response is received correctly on Mac OS X 10.5 and Mac OS X 10.6. On Mac OS X 10.7, I am getting response as "Bad Request" for the same request. When I make a call for same request successively two times following is the

Re: NSURLConnection

2011-06-26 Thread R
Thanks to all on the learning curve On Jun 26, 11:12 pm, Tito Ciuro wrote: > Hello, > > If you have access to the Developer Forums, check the very first entry in > Core OS named "Five Reasons Why Synchronous Networking Is Bad", by Apple's > Quinn "The Eskimo!": > > https://devforums.apple.c

Re: NSURLConnection

2011-06-26 Thread Tito Ciuro
Hello, If you have access to the Developer Forums, check the very first entry in Core OS named "Five Reasons Why Synchronous Networking Is Bad", by Apple's Quinn "The Eskimo!": https://devforums.apple.com/thread/9606?tstart=0 Cheers, -- Tito On Jun 26, 2011, at 9:51 PM, Jerry Krinock wrote:

Re: NSURLConnection

2011-06-26 Thread Jerry Krinock
On 2011 Jun 26, at 09:52, Fritz Anderson wrote: > Synchronous network operations are almost always a bad idea. …, …, …, …, and the error object that you get from -sendSynchronousRequest:returningResponse:error: if it fails is quite nondescript. ___

Re: NSURLConnection

2011-06-26 Thread Gary L. Wade
NSData *data = [NSURLConnection sendSynchronousRequest:request > returningResponse:&response > error:&error]; > > OR > > connectionInProgress=[[NSURLCo

Re: NSURLConnection

2011-06-26 Thread Fritz Anderson
On 26 Jun 2011, at 11:37 AM, R wrote: > Any opinions on which approach is better. > > NSData *data = [NSURLConnection sendSynchronousRequest:request > returningResponse:&response > error:&error]; > >

NSURLConnection

2011-06-26 Thread R
Any opinions on which approach is better. NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&resp

Re: using NSURLConnection to download NSArray

2010-11-09 Thread Stephen Blinkhorn
oblem with this approach is that if the server is down the method appears to hang indefinitely. So I thought I'd use NSURLConnection to download the array and set a timeout value. Everything seems to be working but how can I turn the NSData* object(s) back into an NSArray that I can

Re: using NSURLConnection to download NSArray

2010-11-09 Thread Nick Zitzmann
e > server is down the method appears to hang indefinitely. > > So I thought I'd use NSURLConnection to download the array and set a timeout > value. Everything seems to be working but how can I turn the NSData* > object(s) back into an NSArray that I can access as normal

using NSURLConnection to download NSArray

2010-11-09 Thread Stephen Blinkhorn
So I thought I'd use NSURLConnection to download the array and set a timeout value. Everything seems to be working but how can I turn the NSData* object(s) back into an NSArray that I can access as normal? Thanks, Stephen ___ Cocoa-dev ma

Re: NSURLConnection sync vs async connections

2010-09-23 Thread Jerry Krinock
On 2010 Sep 23, at 02:21, Devraj Mukherjee wrote: > Previous version I used NSURLConnection to make synchronous calls to > the API, parsing the data and then returning results. Only problem of > course is that my API client had to be used in threads so the UI > didn't get lo

Re: NSURLConnection sync vs async connections

2010-09-23 Thread Ken Thomases
On Sep 23, 2010, at 4:21 AM, Devraj Mukherjee wrote: > Previous version I used NSURLConnection to make synchronous calls to > the API > I would like to move towards using async requests. I can grab / parse > the data using the delegate methods, what I am struggling with is how &g

NSURLConnection sync vs async connections

2010-09-23 Thread Devraj Mukherjee
Hi all, I am the maintainer of EtsyCocoa (http://etsycocoa.googlecode.com), its a Cocoa client library for Etsy.com's REST API. I am in the process of re-writing the API client seeing they have released v2 of their API. Previous version I used NSURLConnection to make synchronous calls to th

Re: Does autoreleased NSURLConnection object guarantee job completion?

2010-08-17 Thread Matt Neuburg
Conceptual/URLLoa dingSystem/Tasks/UsingNSURLConnection.html which goes like this (irrelevant parts omitted): NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; ... - (void)connectionDidFinishLoading:(NSURLConnection *)connection { ... [connec

Re: Does autoreleased NSURLConnection object guarantee job completion?

2010-08-13 Thread Michael Ash
On Thu, Aug 12, 2010 at 10:51 PM, yanghb wrote: > if the instance is released in delegate, what to perform the following > code?OK, maybe code segment will always be there, but if the code > access some instance vairable, it just will cause EXEC_ACCESS_BAD, > isn't it? This is absolutely correct.

Re: Does autoreleased NSURLConnection object guarantee job completion?

2010-08-13 Thread yanghb
In my self-defined network handler function, I use a instance variable "connection" to hold NSURLConnection alloced instance, when I will use to load request, so the instance variable can be canceled some where. and the instance will be released before next request performs. th

Re: Does autoreleased NSURLConnection object guarantee job completion?

2010-08-13 Thread Conrad Shultz
On Aug 12, 2010, at 11:06, Keary Suska wrote: > If you really don't want (or can't have) an instance variable, you can > init/alloc then release in connectionDidFinishLoading: and > connection:didFailWithError:. I wouldn't recommend this though, as it is > probably "bad form", but as long you

Re: Does autoreleased NSURLConnection object guarantee job completion?

2010-08-12 Thread Keary Suska
On Aug 12, 2010, at 1:41 PM, Conrad Shultz wrote: > On Aug 12, 2010, at 11:06, Keary Suska wrote: > >> If you really don't want (or can't have) an instance variable, you can >> init/alloc then release in connectionDidFinishLoading: and >> connection:didFailWithError:. I wouldn't recommend this

Re: Does autoreleased NSURLConnection object guarantee job completion?

2010-08-12 Thread Keary Suska
On Aug 12, 2010, at 12:26 AM, Hunje Cho wrote: > Hello, > > I'm just wondering whether autoreleased NSURLConnection object can > finish its job before released. Like below codes. > > // connect to http server for downloading a large file > NSURLConnecti

Does autoreleased NSURLConnection object guarantee job completion?

2010-08-12 Thread Hunje Cho
Hello, I'm just wondering whether autoreleased NSURLConnection object can finish its job before released. Like below codes. // connect to http server for downloading a large file NSURLConnection* con = [NSURLConnection connectionWithRequest:request delegate:self]; // con is not sav

Re: NSURLConnection - data comes in after completion

2010-08-03 Thread Michael Ash
s unclear how you are managing having multiple requests. Do you have >> multiple instances of this class, or does -loadAsync just get called 4 times? > > Yes, I have multiple instances of this class. Any one loader object has > exactly one NSURLConnection in its entire lifetime. > >

Re: NSURLConnection - data comes in after completion

2010-08-02 Thread Fritz Anderson
or does -loadAsync just get called 4 times? Yes, I have multiple instances of this class. Any one loader object has exactly one NSURLConnection in its entire lifetime. This is a loader for images in a table. Up to four image cells may be visible at a time. When the table first appears, each vi

Re: NSURLConnection - data comes in after completion

2010-08-02 Thread David Duncan
On Aug 2, 2010, at 9:40 AM, Fritz Anderson wrote: > The didReceiveData: callback asserts that the data accumulator exists. In > certain circumstances (it seems to be with four of these requests started > nearly simultaneously), the assertion is triggered. self.dataAccumulator is > nil, and ther

NSURLConnection - data comes in after completion

2010-08-02 Thread Fritz Anderson
iOS 4.0.1 SDK, Simulator 4.0. The behavior matches a bug report on 3.x device. I have a problem with NSURLConnection that I've solved, but I don't trust the solution, so I'd like some assurance that I'm doing the right thing. As you see in the code excerpt, I start a dow

Re: NSURLConnection and authenticating against OpenID

2010-07-13 Thread Jerry Krinock
On 2010 Jul 13, at 18:25, Laurent Daudelin wrote: > That's very useful and gives me at least a starting point One more thing I should have mentioned. After you get this thing working and have these passwords, tokens, or whatever, if you want to store them persistently, do it the Correct Way™

[Moderator] Re: NSURLConnection and authenticating against OpenID

2010-07-13 Thread Scott Anguish
On Jul 13, 2010, at 12:40 PM, Laurent Daudelin wrote: > I guess everybody was sleeping yesterday when I sent this so, I'll resend :-) > > I'm using an NSURLConnection to extract information from a website. The > website used to have a simple authentication process

Re: NSURLConnection and authenticating against OpenID

2010-07-13 Thread Laurent Daudelin
't find > anything (or sometimes even if you do), or if OpenID is anything like OAuth, > from experience I would advise that you've got a long difficult slog ahead of > you. But it can be done. You'll just repeatedly use NSURLConnection to send > and receive r

Re: NSURLConnection and authenticating against OpenID

2010-07-13 Thread Jerry Krinock
ifficult slog ahead of you. But it can be done. You'll just repeatedly use NSURLConnection to send and receive requests as indicated in the OpenID documentation. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin request

NSURLConnection and authenticating against OpenID

2010-07-13 Thread Laurent Daudelin
I guess everybody was sleeping yesterday when I sent this so, I'll resend :-) I'm using an NSURLConnection to extract information from a website. The website used to have a simple authentication process based on cookies. Now, they switched to a form of private OpenID. I read a bit

NSURLConnection and authenticating against OpenID

2010-07-13 Thread Laurent Daudelin
I'm using an NSURLConnection to extract information from a website. The website used to have a simple authentication process based on cookies. Now, they switched to a form of private OpenID. I read a bit about this open-source protocol and I'm wondering if it's possible t

Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-22 Thread Keith Duncan
> I had a chicken and egg problem wrt initializing the handler (with a > completion block that needed the connection) and the connection (which needed > the handler). In that circumstance you can decorate the variable that you need to reference inside the block as __block, and set it to nil. Th

Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-22 Thread Keith Duncan
On 20 Jun 2010, at 21:42, John Heitmann wrote: > > On Feb 9, 2010, at 3:01 PM, Keith Duncan wrote: > >> ...you should create a 'concurrent' NSOperation as described in the >> documentation, and schedule your NSURLConnection on +[NSRunLoop >> mainRunLo

Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-22 Thread Keith Duncan
> Lastly, you should run the thread's run loop until your delegate method gets > called indicating the NSURLConnection is done. Don't do that. That was discussed in the previous thread (search the archives). It irresponsibly consumes a workgrou

Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-21 Thread John Heitmann
Thanks for the response. There is definitely a lot of goofiness in that code. I started from the apple xml performance demo, which had run-loop code that led me to believe that I had to run the NSURLConnection run loop in a thread. It's great that that's not the case (I re-read the

Re: Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-21 Thread Kevin Wojniak
NSURLConnection already does its work asynchronously, there is no need to run it on a separate thread. However if you still want to, you should use [NSRunLoop currentRunLoop], which returns the run loop associated with that thread. In your code you are not creating your objects properly. You

Async NSURLConnection and blocks (was: Running NSURLConnection from within an NSOperation?)

2010-06-21 Thread John Heitmann
On Feb 9, 2010, at 3:01 PM, Keith Duncan wrote: > ...you should create a 'concurrent' NSOperation as described in the > documentation, and schedule your NSURLConnection on +[NSRunLoop mainRunLoop]. > This will allow your NSOperation -start method to exit immediately and the

Re: NSURLConnection weirdiness

2010-05-29 Thread Nava Carmon
On May 29, 2010, at 10:12 PM, Jens Alfke wrote: > > On May 29, 2010, at 11:53 AM, Nava Carmon wrote: > >> When I initialize the NSURLConnection I define a timeout in my >> NSURLMutableRequest in order not to stuck the GUI and let the user to work >> with ap

Re: NSURLConnection weirdiness

2010-05-29 Thread Jens Alfke
On May 29, 2010, at 11:53 AM, Nava Carmon wrote: > When I initialize the NSURLConnection I define a timeout in my > NSURLMutableRequest in order not to stuck the GUI and let the user to work > with application. On timeout I get didFailWithError in > NSURLConnectionDelegate and sh

Re: NSURLConnection weirdiness

2010-05-29 Thread Nava Carmon
, that when I try to reach them from safari or from within the application give an error - mostly timeout error. When I initialize the NSURLConnection I define a timeout in my NSURLMutableRequest in order not to stuck the GUI and let the user to work with application. On timeout I get

  1   2   3   4   >