Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Potential leak on a retain
- - (void)generateTokenWithUserId: (NSString *)uniqueId {
- NSLog(@"TokenGenerator - generateTokenWithUserId: '%@'", uniqueId);
- NSString *myMD5String = [Utilities returnMD5Hash:uniqueId];
- // Create the request.
- NSMutableString *authURL = [[NSMutableString alloc] initWithString:CLOUDMADE_AUTH];
- [authURL appendString: localApiKey];
- [authURL appendString: USER_ID];
- [authURL appendString: myMD5String];
- NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:authURL]
- cachePolicy: NSURLRequestUseProtocolCachePolicy
- timeoutInterval: 60.0];
- [theRequest setHTTPMethod: @"POST"];
- NSLog(@"TokenGenerator URL - '%@'", authURL);
- // create the connection with the request
- // and start loading the data
- //NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
- NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
- if (connection) {
- // Create the NSMutableData to hold the received data.
- // receivedData is an instance variable declared elsewhere.
- responseData = [[NSMutableData data] retain];
- } else {
- // Inform the user that the connection failed.
- }
- [authURL release];
- }
- - (void) dealloc {
- NSLog(@"TokenGenerator - dealloc");
- [responseData release];
- [localApiKey release];
- [super dealloc];
- }
- @class TokenGenerator;
- @protocol TokenGeneratorDelegate <NSObject>
- - (void)tokenGeneratorDidFinishGeneration:(TokenGenerator *)tokenGenerator token:(NSString *)tokenGenerated;
- @end
- @interface TokenGenerator : NSObject {
- NSString *localApiKey;
- id<TokenGeneratorDelegate> delegate;
- NSMutableData *responseData;
- }
- @property (nonatomic, assign) id<TokenGeneratorDelegate>delegate;
- - (id) initWithApikey:(NSString*) apiKey delegate:(id)anObject;
- - (void)generateTokenWithUserId: (NSString *)uniqueId;
- @end
- NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
Add Comment
Please, Sign In to add comment