Моих делегатов NSURLConnection не вызывают.Я пытаюсь сделать это вместо использования [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[NSURL URLWithString: urlAddress] host]];
, это не разрешено для магазина приложений.
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
myError.hidden = FALSE;
NSHTTPURLResponse * response;
NSError * error;
NSMutableURLRequest * request;
NSString * params;
NSString *urlAddress = [NSString stringWithFormat:@"%@/?action=request&api=json&module=ManagementModule&function=startSession&instance=0",[ConnectServer returnserverip]];
NSLog(@"UPX %@",[ConnectServer returnserverip]);
NSLog(@"IP %@",[ConnectServer returnclientip]);
if([defaults boolForKey:@"enablePincode"]){
NSString *account = [defaults stringForKey:@"myAccount"];
NSString *username =[defaults stringForKey:@"myUsername"];
NSString *password = [defaults stringForKey:@"myPassword"];
NSString *clientip = [ConnectServer returnclientip];
NSString *clientname = [ConnectServer returnclientname];
params = [[[NSString alloc] initWithFormat:@"params=&auth[password]=%@&auth[mode]=%@&auth[account]=%@&auth[user]=%@&auth[rights]=%@&auth[user_ip]=%@&auth[client_name]=%@",password,@"password",account,username,@"user",clientip,clientname] autorelease];
request = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAddress] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60] autorelease];
NSData *myRequestData = [params dataUsingEncoding:NSUTF8StringEncoding];
//[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[NSURL URLWithString: urlAddress] host]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:myRequestData];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [myRequestData length]] forHTTPHeaderField:@"Content-Length"];
request.URL = [NSURL URLWithString:urlAddress];
error = nil;
response = nil;
NSData * data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
>>>>>>NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self ];
>>>>>>[connection start];
NSLog(@"The server saw:\n%@", [[[NSString alloc] initWithData:data encoding: NSASCIIStringEncoding] autorelease]);
NSLog(@"Parameters: %@", params);
NSLog(@"Actual sended parameters to the server: %@", myRequestData);
NSString *Sresponse;