15
15
16
16
17
17
@interface NXOAuth2Connection ()
18
- + (NSURLConnection *)createStartedConnectionWithRequest : (NSURLRequest *)aRequest connectionDelegate : (id )connectionDelegate streamDelegate : (id )streamDelegate client : (NXOAuth2Client *)theClient ;
18
+ + (NSURLConnection *)startedConnectionWithRequest : (NSURLRequest *)aRequest connectionDelegate : (id )connectionDelegate streamDelegate : (id )streamDelegate client : (NXOAuth2Client *)theClient ;
19
19
@end
20
20
21
21
@@ -34,7 +34,7 @@ - (id)initWithRequest:(NSURLRequest *)aRequest
34
34
client = [aClient retain ]; // TODO: check if assign is better here
35
35
36
36
request = [aRequest copy ];
37
- connection = [[self class ] createStartedConnectionWithRequest : request connectionDelegate: self streamDelegate: self client: client];
37
+ connection = [[[ self class ] startedConnectionWithRequest : request connectionDelegate: self streamDelegate: self client: client] retain ];
38
38
}
39
39
return self;
40
40
}
@@ -72,13 +72,13 @@ - (void)retry;
72
72
{
73
73
[self cancel ];
74
74
[connection release ];
75
- connection = [[self class ] createStartedConnectionWithRequest : request connectionDelegate: self streamDelegate: self client: client];
75
+ connection = [[[ self class ] startedConnectionWithRequest : request connectionDelegate: self streamDelegate: self client: client] retain ];
76
76
}
77
77
78
78
79
79
#pragma mark Private
80
80
81
- + (NSURLConnection *)createStartedConnectionWithRequest : (NSURLRequest *)aRequest connectionDelegate : (id )connectionDelegate streamDelegate : (id )streamDelegate client : (NXOAuth2Client *)theClient ;
81
+ + (NSURLConnection *)startedConnectionWithRequest : (NSURLRequest *)aRequest connectionDelegate : (id )connectionDelegate streamDelegate : (id )streamDelegate client : (NXOAuth2Client *)theClient ;
82
82
{
83
83
NSMutableURLRequest *startRequest = [[aRequest mutableCopy ] autorelease ];
84
84
@@ -95,7 +95,7 @@ + (NSURLConnection *)createStartedConnectionWithRequest:(NSURLRequest *)aRequest
95
95
NSURLConnection *aConnection = [[NSURLConnection alloc ] initWithRequest: startRequest delegate: connectionDelegate startImmediately: NO ]; // don't start yet
96
96
[aConnection scheduleInRunLoop: [NSRunLoop currentRunLoop ] forMode: NSDefaultRunLoopMode ]; // let's first schedule it in the current runloop. (see http://github.com/soundcloud/cocoa-api-wrapper/issues#issue/2 )
97
97
[aConnection start ]; // now start
98
- return aConnection;
98
+ return [ aConnection autorelease ] ;
99
99
}
100
100
101
101
0 commit comments