Bonjour à tous,

je récupère des données dans un objet NSData que je transforme en NSString.
Je passe ma string dans un tableau que je veux parcourir.

Mon problème, je n'arrive pas à récupérer les chaines que j'ai stocké dans mon tableau, voici le code:

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
 
 
NSData *response = [[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]autorelease];
 
	NSString *json_string = [[[NSString alloc] initWithData:response encoding:NSASCIIStringEncoding]autorelease];
 
	NSString *clean = [[[[[[[[json_string stringByReplacingOccurrencesOfString:@"," withString:@""]
							 stringByReplacingOccurrencesOfString:@"null]" withString:@""]
							stringByReplacingOccurrencesOfString:@"[" withString:@""]
						   stringByReplacingOccurrencesOfString:@":" withString:@""]
						  stringByReplacingOccurrencesOfString:@"\"\"" withString:@"\""]
						 stringByReplacingOccurrencesOfString:@"}{" withString:@","]
						stringByReplacingOccurrencesOfString:@"{" withString:@""]
					   stringByReplacingOccurrencesOfString:@"}" withString:@""];
 
 
 
	pageResultat=[[[NSMutableArray alloc]init]autorelease];
	pageResultat=[clean componentsSeparatedByString:@"\""];
 
	NSInteger compteurTableauJson =1;
	NSMutableString * chaineTest=[[[NSMutableString alloc] init]autorelease];
 
	while (compteurTableauJson <= [pageResultat count]) {
		[chaineTest setString:[pageResultat objectAtIndex:compteurTableauJson]]; // L'erreur est ici !!!!!!!!!!!!!!!!!!!!!
			if([chaineTest isEqualToString:@"id_bien"]){
				[self.afficheResultat addObject:[[[bien alloc] initWithId:(NSString *)[pageResultat objectAtIndex:compteurTableauJson+1] andCp:(NSString *)[pageResultat objectAtIndex:compteurTableauJson+3] andSurf:(NSString *)[pageResultat objectAtIndex:compteurTableauJson+5] andPrix:(NSString *)[pageResultat objectAtIndex:compteurTableauJson+7] andPieces:(NSString *)[pageResultat objectAtIndex:compteurTableauJson+9] andCategorie:(NSString *)[pageResultat objectAtIndex:compteurTableauJson+11]]autorelease]];
				compteurTableauJson+=12;
 
			}
 
			compteurTableauJson++;
		}
 
	[sacTest release];
Merci d'avance pour le temps que vous consacrerez à m'aider.

Cordialement Jason T.