0
我是Analyze
我的應用程序用於搜索任何泄漏,在這裏我們與「存儲到replyString
存儲的對象的潛在泄漏」。 我試過每一個版本都沒有,但沒有任何改變,所以我在這裏尋求一些幫助。泄漏與HttpRequest方法 - Objective-c
我在我的WebService類中創建了這個方法。
-(NSString *)httpRequest{
NSData *postData = [self dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:adresse]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postData];
NSHTTPURLResponse *response = nil;
NSError *error = nil;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *replyString = [[NSString alloc] initWithBytes:[responseData bytes] length:[responseData length] encoding: NSASCIIStringEncoding];
return replyString;
}
謝謝:)
我在這之前試過和我的應用程序崩潰,但它似乎現在工作,謝謝! – Charlou