i am working on xml parsing and getting three item numbers from the server 1 2 3, i have taken the three numbers into nsmutable array and assign them in delegate value mutable array, now i want to pass one number at a time into another function to get response from the server, so someone please let me know that how to convert NSMutable array value into integer while parsing into another function.
4 Answers
do like this
for(int i=0;i<[yourArrayFromXmlParsing count];i++)
{
int a=[[yourArrayFromXmlParsing objectAtIndexPath:i] intValue];
[obj function:a];
}
4 Comments
Guillaume
It would be better (less prone to error and easier to read) to use fast enumeration.
thanks for the information i have added the functionality which u said,it is calling the function in which next api is there, however it is not setting any connection after calling api first time , it count the loop and called api second time , i want that when api have called first time it should continue the xml parsing and after parsing is finished it should call second time and similar to that based on the objects.
Ishu
I could not understand what you want.
i will let u know the information GetGroups *group = [[GetGroups alloc] init]; for(int i=0;i<[dataArray count];i++){ int a = [[dataArray objectAtIndex:i] intValue]; [group getGroups:a]; } where in dataArray i have collected Three values and after that calling the next API throught [group getGroups] and passing the number in variable a, it is passing the information however it is not completing the full xml parsing after taking information it again run the loop 2 time and after that 3 time and showing only the last information for 3 number and parsing completed
Assuming inside your array, you have NSNumber objects:
for (NSNumber *aNumber in yourArrayFromXmlParsing) {
resultFromServer = [self fooMethod:[aNumber intValue]];
}