title: FBLogin assign delegate from UIView
body: <p>I have a FBLogin (Facebook SDK) button I am using in a view being replicated throughout many of my view controllers. It seems I cannot set a UIView as a delegate to the Facebook SDK, so I am trying to create a seperate ViewController to handle the delegate functions of the Facebook  SDK.</p>
  
  <p><strong>Header file:</strong></p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import &lt;FacebookSDK/FacebookSDK.h&gt;
  
  @class AppDelegate, FBDelegateViewController;
  @interface UserView : UIView {
  
      AppDelegate *appDelegate;
  
      IBOutlet UIView *contentView;
      IBOutlet UIImageView *userImage;
      IBOutlet UILabel *firstName;
      FBDelegateViewController *fbDelegate;
      IBOutlet FBLoginView *FacebookLogin;
  
  }
  
  @property (nonatomic, strong) IBOutlet UIView *contentView;
  @property (nonatomic, strong) IBOutlet UILabel *firstName;
  @property (nonatomic, strong) AppDelegate *appDelegate;
  @property (nonatomic, strong) FBDelegateViewController *fbDelegate;
  </code></pre>
  
  <p><strong>Currently in my implementation I am doing the following:</strong></p>
  
  <pre><code>#import "UserView.h"
  #import "AppDelegate.h"
  #import "FBDelegateViewController.h"
  #import &lt;FacebookSDK/FacebookSDK.h&gt;
  
  @implementation UserView
  
  @synthesize contentView, firstName, appDelegate, fbDelegate;
  
  - (void)awakeFromNib {
  
      fbDelegate = [[FBDelegateViewController alloc] init];
      appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  
      [[NSBundle mainBundle] loadNibNamed:@"UserView" owner:self options:nil];
      [self addSubview:self.contentView];
      [userImage.layer setCornerRadius:21.5];
  
      [FacebookLogin setDelegate:fbDelegate];
  
  }
  
  @end
  </code></pre>
  
  <p><strong>The application crashes with the following:</strong></p>
  
  <p>*<em>*</em> Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setDelegate:]: unrecognized selector sent to instance 0xa5e4f80'*</p>
  
  <p>In interface builder the UIView that contains the FBLogin item is set.</p>
  
  <p>I also tried delegation with the UIView as well, but it looks like a UIView cannot be a delegate for a FBLogin?</p>
  
  <p>Sorry, new territory here. Typically have used the associated view controller as a delegate - but want to understand external delegation.</p>