I am writing an iPhone application and I have finally decided to use RestKit as the framework for connecting to REST Services.
The way I am thinking of building is to h
I'm the author of RestKit and we advocate using such patterns to build higher level abstractions on top of RestKit. I generally build my callbacks and such around a model object rather than creating a new LoginService type of object, but either way is fine. In my example, you would do something like:
@implementation RKUser
- (void)loginWithDelegate:(NSObject<RKUserAuthenticationDelegate>*)delegate {}
@end
@protocol RKUserAuthenticationDelegate
- (void)userDidLogin:(RKUser*)user;
- (void)userDidFailLoginWithError:(RKUser*)user;
- (void)userDidLogout:(RKUser*)user
@end
In any case, the other thing I would recommend is changing your delegate from a retain to an assign. In your dealloc method, you can do a couple of things:
[[RKRequestQueue sharedQueue] cancelRequestsWithDelegate:self];
That's about all that you need to worry about from a memory management / house-keeping perspective. The other thing that I typically always wind up doing is creating notifications for my authentication life-cycle events. You just always wind up needing to observe them to update UI somewhere in my experience.
You are on the right track and the design is fine.
Best, Blake