Domanda

Ho il codice seguente

 hostStr = [hostStr stringByAppendingString:post];
NSData *dataURL =  [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]];    
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];    

NSError *error = nil;
NSDictionary *result = [NSJSONSerialization 
                        JSONObjectWithData:dataURL
                        options:kNilOptions 
                        error:&error];

NSArray *files = [result objectForKey:@"GV_Return"];

NSLog(@"Files: %@", files);

// For Each Key we seperate the data and add it to an object to be used.
for (NSDictionary *file in files)
{           
NSString *userNumber = [result objectForKey:@"UserNumber"];
NSLog(@"output: %@", userNumber);
}

Il problema che sto riscontrando è quello Nslog (@"files: %@", file); Restituisce quello che mi aspetto

Files: (
    {
    UserNumber = 1;
}
)

Tuttavia Nslog (@"output: %@", numero più nervoso); ritorna NULLO

Ho bisogno di aiuto per capire perché NSString *Nomiterio = [risultato ObjectForkey:@"NomeTernumber"]; Non sembra che stia tornando "1" come dovrebbe.

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top