Come per codificare i dati XML
-
25-09-2019 - |
Domanda
Nella mia app ho per inviare una richiesta di dati XML come, sto creando la stringa XML come questo
NSString* str = @"<Item><Name>";
str = [str stringByAppendingFormat:string1];
str = [str stringByAppendingFormat:@"</Name><Description>"];
str = [str stringByAppendingFormat:string2];
str = [str stringByAppendingFormat:@"</Description><Rate>"];
str = [str stringByAppendingFormat:string3];
str = [str stringByAppendingFormat:@"</Rate></Item>"];
Dopo che sto creando un URLString.
NSString* curl = @"url?";
curl = [curl stringByAppendingString:@"string"];
curl = [curl stringByAppendingString:@"&apikey=@"value"&searchtext="];
curl = [curl stringByAppendingString:[aString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
di quanto mi sto creando NSURL passando la stringa NSURL * finalURL = [NSURL URLWithString: ricciolo];
* NSMutableURLRequest theRequest = [NSMutableURLRequest requestWithURL: finalURL cachePolicy: NSURLRequestReloadIgnoringCacheData TimeoutInterval: 10]; [TheRequest setHTTPMethod: @ "POST"];
Ma io non sto ottenendo il risultato
È codifica la stringa XML è corretto?
Può uno aiutarmi
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow