I am using an external library called 'ASIHTTPRequest' that I am using to submit a form that is on a web server through my app. Everything works great and I get the html of the response of the request. The html contains a link I get and I then do another request on that link to get the html of the second request. Heres my problem, when I try and request that link that was in the html (I have stripped it down to just the link, I am positive.) I get the same html response as the first response I got. My code will not format correctly in the page. Here is the code at http://pastie.org
2 Answers
There are a few small errors causing your problem here:
Your
if (i==1) { … }
statement is nested inside youif (i==0) { … }
statement (perhaps a mismatched closing bracket is to blame?Your
if (i==1) { … }
, once in the correct spot will want to beelse if (i==0) { … }
Basically, the first time requestFinished:
gets called and (i
is 0) it starts off, adds 1 to i
, makes the second request, and (still in the first response) checks to see if i
is 1. i
will always be 1 there so it pops up the alert view. When the second request finishes it never checks to see if i
is 1 because that is nested inside the check for i
being 0.
The reason you’ll want else if …
is because otherwise the second if-statement will always trigger immediately after the first (because you do i++
).