I'm trying to use Amazon API for iOS that handles the login for Amazon website in Objective-C. I'm using this source.
However, when I implement AMZNAuthorizeUserDelegate
, I get the following error message:
ARC forbids explicit message send of 'retain'.
I've never used Objective-C before so I would appreciate if anyone could help me with the code.
Here is my code:
#import <LoginWithAmazon/LoginWithAmazon.h>
#import "AMZNAuthorizeUserDelegate.h"
#import "AMZNGetProfileDelegate.h"
@implementation AMZNAuthorizeUserDelegate
- (id)initWithParentController:(ViewController*)aViewController {
if(self = [super init]) {
parentViewController = [aViewController retain];
}
return self;
}
- (void)requestDidSucceed:(APIResult *)apiResult {
AMZNGetProfileDelegate* delegate = [[[AMZNGetProfileDelegate alloc] initWithParentController:parentViewController] autorelease];
[AIMobileLib getProfile:delegate];
}
- (void)requestDidFail:(APIError *)errorResponse {
NSString *message = errorResponse.error.message;
// Your code when the authorization fails.
[[[[UIAlertView alloc] initWithTitle:@"" message:[NSString
stringWithFormat:@"User authorization failed with message: %@",
errorResponse.error.message] delegate:nil
cancelButtonTitle:@"OK"otherButtonTitles:nil] autorelease] show];
}
@end