运行代码对于数组的每个元素

时间:2013-05-22 09:01:01

标签: ios soap nsarray

我有以下代码

 DownloadOperations *DataObj=[[DownloadOperations alloc]init];
[DataObj ID];

NSString *body=[NSString stringWithFormat:@"<?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body><GetDocumentUpdatedInfo xmlns='http://tempuri.org/'><DocumentID>%@</DocumentID></GetDocumentUpdatedInfo></soap:Body></soap:Envelope>", [DataObj ID]];
NSLog(@"Body %@", body);
此代码中的

[DataObj ID]NsMutablearrayNSString(正文)是soap Request,需要string值。如何让soap request针对array的每个元素进行迭代运算?

1 个答案:

答案 0 :(得分:1)

int loopCount = 0;
while (loopCount < [[DataObj ID] count]){
    //Do stuff with [[DataObj ID] objectAtIndex:loopCount]
    loopCount++;
}