title: Call web service with interactive push notification iOS 8
body: <p>I am trying to implement interactive push notification in my app. The app successfully received the notification.</p>
  
  <p>When the notification received, I have two buttons on the lock screen.Both of them are supposed to initiate two Webservices</p>
  
  <p>Here is my code in <code>application  handleActionWithIdentifier</code></p>
  
  <pre><code>    func application(application: UIApplication, handleActionWithIdentifier identifier: String?, forRemoteNotification userInfo: [NSObject : AnyObject], completionHandler: () -&gt; Void) {
  
  
      let aps = userInfo["aps"] as NSDictionary
      let id = aps["id"] as Int
      let notification = Notifications()
      notification.notificationId = NSNumber(integer: id)
  
      if identifier == "APPROVE"{
          APIManager.sharedInstance.approveApprovalRequest(notification)
      }
      else if identifier == "DELETE"{
          APIManager.sharedInstance.dismissBulletin(notification)
      }
      completionHandler()
  }
  </code></pre>
  
  <p>I used </p>
  
  <pre><code> NSURLSession.sharedSession().dataTaskWithRequest(request, 
      completionHandler: { (data, response, error) -&gt; Void in}).resume()
  </code></pre>
  
  <p>for web service call.</p>
  
  <p>But it returns connection errors.</p>
  
  <p>How can I solve this. Any help appreciated.</p>
  
  <p>EDIT:</p>
  
  <p>This is the error I received in log</p>
  
  <pre><code>Error Domain=NSPOSIXErrorDomain Code=9 "The operation couldn’t be completed.Bad file descriptor"
  
  UserInfo=0x1552ca00 {_kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=9}
  </code></pre>