Bonjour,
j'ai une fonction qui va effectuer une requete asynchrone pour lire un json mais sur le serveur il y a un htaccess, je ne peux donc pas lire le json.
comment faire une authentification ?
voici ma fonction de connection :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-(BOOL) _sendAsynchronousRequestWithStringURL:(NSString*)stringURL method:(NSString*)method attachedData:(NSData*)attachedData delegate:(id<WebServiceDelegate>)delegate andKey:(id)key{
    if (stringURL == nil){
        return NO;
    }
 
	// Create the request
    NSURL * url = [[NSURL alloc] initWithString:[stringURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
	NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:timeoutInterval];
    [url release];
    [request setHTTPMethod:method];
 
    //Si des donnees sont attachees
    if (attachedData){
        [request addValue:@"text/plain" forHTTPHeaderField:@"Content-Type"];
        [request setHTTPBody: attachedData];
    }
 
	// Send the request asynchronously
	NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
 
 
    //[request release];
 
    if (!connection){
        return NO;
    }
 
    //On sauvegarde les infos de la connection
    WebServiceConnection * webServiceConnection = [[WebServiceConnection alloc] initWithConnection:connection delegate:delegate andKey:key];
 
	NSValue * connectionKey = [NSValue valueWithNonretainedObject:connection];
    [connections setObject:webServiceConnection forKey:connectionKey];
 
    NSLog(@"Ouverture d'une connection internet (total %d) pour l'adresse : %@", [connections count], stringURL); 
 
    [webServiceConnection release];    
    [connection release];
 
    return YES;
}
merci d'avance