title: UIAlertView is Deprecated how can i fix this code as UIAlertController? I can't figure out how to use switch statement in UIAlertController
body: <p>I've tried Several ways to fix this deprecated code but nothing helped me I'm new to Objective C and iOS please help me fix this...It's working fine in iOS8 but not in iOS9..</p>
  
  <pre><code>- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
  {
      [super alertView:alertView clickedButtonAtIndex:buttonIndex];
  
      if (buttonIndex)
      {
          switch (alertView.tag)
          {
              case kAccessAddressBook:
              {
                  [self displayFindFriendView:[NSNumber numberWithInteger: CS_CONTACTS ]];
              }
                  break;
              case kFindFriendEmail:
              {
  
              }
                  break;
              case kLogout:
              {
                  // Hit Logout API
                  [self userLogout];
              }
                  break;
              case kClearSearchHistory:
              {
                  // Clear Search History Data base.
                  [[CSCoreDataHandler sharedInstance] deleteManagedObjectsInModel:@"CSRecentSearch"];
  
              }
                  break;
              default:
                  break;
          }
      }
  }
  </code></pre>