0

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.

1
  • Can you be more specific Commented Mar 4, 2011 at 10:17

4 Answers 4

3

do like this

for(int i=0;i<[yourArrayFromXmlParsing count];i++)
{
  int a=[[yourArrayFromXmlParsing objectAtIndexPath:i] intValue];
  [obj function:a]; 
}
Sign up to request clarification or add additional context in comments.

4 Comments

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.
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
0

If u have added each number into the array u can access them by using the index of the array.

Comments

0
[[myArray objectAtIndex:i] intValue];

Comments

-2

Assuming inside your array, you have NSNumber objects:

for (NSNumber *aNumber in yourArrayFromXmlParsing) {
    resultFromServer = [self fooMethod:[aNumber intValue]]; 
}

2 Comments

sorry bro, but you are not convert NSNumber into integer.
Sorry, forgot the fact that the OP wanted a int. Edited the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.