Reset isLoading *after* calling delegates on errors #720

wants to merge 1 commit into from

2 participants


This commit sets isLoading to NO after calling delegates. This solves the following issue in our app:

  • Make request to server, but iPhone is offline, so an error happens
  • In our delegate we check that the phone is offline and show the user an alert
  • However, since isLoading is set to NO before that alert, the request if executed over and over again while the alter is being shown
  • This results in the alert being shown multiple times, you have to click through them all which is very confusing (not too mention annoying)

By moving isLoading down, only one error message is displayed. Then once RestKit leaves this messages, it will clear the request out of the queue so its only executed once.

Let me know if you have any questions - but this small changes makes a big difference for our app.

Thanks - Charlie

Charlie Savage Set isLoading *after* calling delegates. This avoids reelecting the s…
…ame request multiple times in some situations.
The RestKit Project member

So I actually think its incorrect to have the request return YES for isLoading once we get into the callbacks. What I have done instead is flip isLoaded to YES at the same time that isLoading becomes NO. This causes isUnsent to return NO and suppresses the repeated dispatching.

@blakewatters blakewatters added a commit that closed this pull request May 17, 2012
@blakewatters blakewatters Fixes to ensure failed requests are not resent. refs #628, fixes #744,…
… closes #720

Additional changes and test coverage to handle the case of loading an invalid URL
or otherwise immediately encountering an error condition:

* Restores use of removeLoadingRequest: within the queue
* Updates fragile tests to ensure better coverage for error cases
* Sets isLoaded to YES during error callbacks to prevent duplicated dispatching
The RestKit Project member

@cfis Please give the latest development bits a try to verify that your issue is cleaned up.

@alexbird alexbird pushed a commit to kotikan/RestKit that referenced this pull request Jun 22, 2012
Alex Bird Fixes to ensure failed requests are not resent - applied to RKObjectL…
…oader (previously had only been applied to its superclass RKRequest) fixes #720
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment