Guest User

Untitled

a guest
May 27th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. - (BOOL)verifyDelegate:(id <MyOperationDelegate>)delegate
  2. {
  3. BOOL isGood = YES;
  4.  
  5. __delegateHasFailedWithErrorMethod = [delegate respondsToSelector:@selector(operation:failedWithError:)];
  6. __delegateHasLoadedImageMethod = [delegate respondsToSelector:@selector(operation:loadedImage:)];
  7.  
  8. isGood = __delegateHasFailedWithErrorMethod && __delegateHasLoadedImageMethod;
  9.  
  10. if (!isGood)
  11. {
  12. NSLog(@"Delegate for MyOperation does not fully implement all methods");
  13. if (__delegateHasFailedWithErrorMethod == NO)
  14. NSLog(@"Delegate for MyOperation does not respond to SEL(operation:failedWithError:)");
  15. if (__delegateHasFailedWithErrorMethod == NO)
  16. NSLog(@"Delegate for MyOperation does not respond to SEL(operation:loadedImage:)");
  17. }
  18.  
  19. return isGood;
  20. }
Add Comment
Please, Sign In to add comment