0

I'm working with RestKit for iPad right now. I use a REST Service which needs HTTP Basic Authentication. If the User enters wrong credentials, i catch that and show a UIAlert telling the user where is the problem.

Therefore i created a delegate method, which is called if RestKit raises an error -1012.

It works, but it looks like RestKit tries to authenticate 3 times with the wrong credentials and so the delegate get's called 3 times (with 3 UIAlerts being shown to the user).

Can RestKit be configured to only try once if the authentication works?

MadMaxAPP
  • 1,035
  • 2
  • 16
  • 39
  • Is it possible that you send three requests at once with wrong credentials? If that's the case you'll get three error callbacks - each for one request. – mja Nov 16 '11 at 11:30
  • ok. i will investigate in this direction and give feedback. – MadMaxAPP Nov 16 '11 at 11:44
  • Yes! you were right! I send 3 requests from 3 different methods in my class. Now i need something to "lock" Requests from being processed if a reqeuest fails because of authentication. . . – MadMaxAPP Nov 16 '11 at 11:49

1 Answers1

1

The issue is that multiple running requests are failing because all are sent with the same (invalid) credentials.

You can try to cancel the remaining requests as soon as you receive first failure, try something like this:

  [[[[RKObjectManager sharedManager] client] requestQueue] cancelRequestsWithDelegate:self];
mja
  • 5,056
  • 1
  • 29
  • 40