2010-04-08 51 views
0

在我的應用程序,我必須發送一個XML數據的請求,我創造這樣如何編碼XML數據

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>"]; 

XML字符串我創建一個URLString之後。

NSString* curl = @"url?"; 
curl = [curl stringByAppendingString:@"string"]; 
curl = [curl stringByAppendingString:@"&[email protected]"value"&searchtext="]; 
curl = [curl stringByAppendingString:[aString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; 

比我通過將串 NSURL * finalURL創建NSURL = [NSURL URLWithString:捲曲];我們可以使用NSMutableURLRequest * theRequest = [NSMutableURLRequest requestWithURL:finalURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10]; [theRequest setHTTPMethod:@「POST」];

但我沒有得到結果

編碼xml字符串是否正確?

任何一個人都可以幫我嗎

回答