title: App Crashes with: unrecognized selector sent to instance"
body: <p>The "Back" button in my app, when pressed, correctly takes me to the main view/screen, then the app crashes, Debug screen giving me this:</p>
  
  <blockquote>
    <p>Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RLMRealmNotificationToken invalidate]: unrecognized selector sent to instance 0x600003bd57e0</p>
  </blockquote>
  
  <p>I stepped through the code with Debug and see the last line of code executed before it crashes.</p>
  
  <p>In the code I see this error "Thread 1: signal SIGABRT" and have read here that this is likely related to the IBAction not working properly on my Back button but can't figure out where the issue is in the code.  My project does not show the Back button on the Storyboard, as it is coded. </p>
  
  <p>Here is the code where my CustomBackButton is defined.</p>
  
  <pre><code>#import "ViewControllerHelper.h"
  #import "ProfileRealm.h"
  
  @interface ViewControllerHelper ()
  
  - (void)setCustomTitle;
  - (void)setCustomBackButton;
  - (void)profilesAction:(id)sender;
  
  @end
  
  @implementation ViewControllerHelper
  
  - (id)initWithViewController:(UIViewController *)viewController       andProfile:(ProfileRealm *)profile {
      self = [super init];
      if(self) {
          _viewController = viewController;
          _profile = profile;
  
          [self setCustomTitle];
          [self setCustomBackButton];
      }
      return self;
  }
  
  - (void)setCustomTitle {
      if (_profile == nil)
          return;
  
      NSMutableAttributedString *string = [[NSMutableAttributedString     alloc] initWithString:_profile.name];
  
      UIFont *font1 = [UIFont boldSystemFontOfSize:15.0];
      [string addAttribute:NSFontAttributeName value:font1 range:NSMakeRange(0, string.length)];
  
      [string appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n"]];
  
      NSUInteger start = string.length;
  
      [string appendAttributedString:[[NSMutableAttributedString alloc] initWithString:_profile.friendlyName]];
      UIFont *font = [UIFont boldSystemFontOfSize:15.0];
      [string addAttribute:NSFontAttributeName value:font range:NSMakeRange(start, string.length - start)];
  
      NSMutableParagraphStyle *paragrapStyle = [[NSMutableParagraphStyle alloc] init];
      paragrapStyle.alignment = NSTextAlignmentCenter;
      [string addAttribute:NSParagraphStyleAttributeName value:paragrapStyle range:NSMakeRange(0, string.length)];
  
      UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,0,44,44)];
      [titleLabel setAttributedText:string];
      [titleLabel setNumberOfLines:2];
      //    [titleLabel setTextColor:[UIColor whiteColor]];
  
      _viewController.navigationItem.titleView = titleLabel;
  }
  
  - (void)setCustomBackButton {
      UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithImage:  [UIImage imageNamed:@"monkeys"]
                                                                       style:UIBarButtonItemStylePlain
                                                              target:self     action:@selector(profilesAction:)];
      _viewController.navigationItem.leftBarButtonItem = item;
  }
  
  - (void)profilesAction:(id)sender {
      //MARK - App Crashes after next line is executed
      [_viewController.tabBarController.navigationController  popViewControllerAnimated:YES];
  }
  
  @end
  
  
      //Post Crash, I get a SIGABRT error in the main file
      // Here is that code:
  
      #import &lt;UIKit/UIKit.h&gt;
      #import "AppDelegate.h"
  
      int main(int argc, char * argv[]) {
          @autoreleasepool {
              return UIApplicationMain(argc, argv, nil,      NSStringFromClass([AppDelegate class]));
          }
      }
  </code></pre>