0
我是ios開發的新手。我正在開發其消費SOAP Web服務的應用程序,現在我面臨的一個問題,在web服務的返回值的方法,JSON字符串,但它看起來像它下面webservice在ios中返回json數據爲XML
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/「>[「data」1,」data」2,」data」3,」data」4]</string>
給出正因爲如此我不能XML數據當我試圖解析它顯示以下錯誤時,使用SBJSONParser將json轉換爲NSArray
-JSONValue失敗。錯誤是:令牌非法的開始[<]
我的代碼如下
- (void)requestFinished:(ASIHTTPRequest *)request
{
if (request.responseStatusCode == 400) {
txtCode.text = @"Invalid code";
} else if (request.responseStatusCode == 403) {
txtCode.text = @"Code already used";
} else if (request.responseStatusCode == 200) {
NSString *responseString = [request responseString];
NSLog(@"%@",responseString);
NSDictionary *responseArray =[responseString JSONValue];
NSLog(@"%@",responseArray);
} else {
txtCode.text = @"Unexpected error";
}
}
給予我知道我的代碼一些錯誤,但我不能找出問題,請幫助我....
在此先感謝。