我有一个基于 tableView 的应用程序 Core Data . 由于 NSFetchedResultsController 及其 Delegate 协议方法,每个单元格都是可删除的并且非常酷 . 但是我希望在删除特定单元格时取消特定的 UILocalNotification 实例 . Core Data 包含 UILocalNotificationuserInfo 的所有信息 . 我可以使用'm really stopped here. Can anybody tell me? If it'而不是 Core Data 吗?

这就是我所做的 . 它似乎工作正常,但我不知道它是否正确

`override func tableView(tableView:UITableView,commitEditingStyle editingStyle:UITableViewCellEditingStyle,forRowAtIndexPath indexPath:NSIndexPath){

如果editingStyle == . 删除{

let delete = self.fetchedResultsController.objectAtIndexPath(indexPath) as? NSManagedObject
        let cell = tableView.cellForRowAtIndexPath(indexPath)

        for notification in UIApplication.sharedApplication().scheduledLocalNotifications! {
            if (notification.userInfo!["givenName"] as? String == cell?.textLabel?.text) {
            UIApplication.sharedApplication().cancelLocalNotification(notification)
            break
           }
        }
        self.managedObjectContext.deleteObject(delete!)  // Delete Action

        do {
        // Save Action
        try self.managedObjectContext.save()  // Save Action
        } catch { // An Error 
      }
    }
  }

`

谢谢