Skip to content

Commit

Permalink
Delegate check before save
Browse files Browse the repository at this point in the history
  • Loading branch information
nonelse committed Dec 8, 2014
1 parent fdd06dd commit 614bee4
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Adjust/ADJConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,23 @@ - (id) initWithAppToken:(NSString *)appToken
}

- (void) setDelegate:(NSObject<AdjustDelegate> *)delegate {
_delegate = delegate;
if (delegate == nil) {
_delegate = nil;
self.hasDelegate = NO;
return;
}

if (![delegate respondsToSelector:@selector(adjustAttributionChanged:)]) {
id<ADJLogger> logger = ADJAdjustFactory.logger;
[logger warn:@"Delegate configured does not implement AdjustDelegate"];
[logger error:@"Delegate does not implement AdjustDelegate"];

_delegate = nil;
self.hasDelegate = NO;
return;
}
self.hasDelegate = (delegate != nil);

_delegate = delegate;
self.hasDelegate = YES;
}

- (BOOL) checkEnvironment:(NSString *)environment
Expand Down

0 comments on commit 614bee4

Please sign in to comment.