试图在释放时加载视图控制器的视图。核心聚光灯

Attempting to load the view of a view controller while it is deallocating. CoreSpotlight

我将 CoreSpotlight 集成到我的应用程序中。我希望用户将在 Spotlight 搜索中找到需要的信息,并且在用户将在 Spotlight 中打开此信息后,信息将在 DetailViewController 中打开。我做到了,Spotlight 工作得很好,但是当应用程序打开时我看到这个错误 在视图控制器释放时尝试加载视图控制器的视图是不允许的,并且可能导致未定义的行为(UIAlertController:0x1245a0560) 虽然我不使用 UIAlertController。我在 AppDelegate func 中调用了 UITableViewController 的函数,它必须按索引打开对象。但它没有出现。 showData() performSegueWithIdentifier("show", sender: nil)原因仍然存在错误:'Receiver () has no segue with identifier 'show''。虽然我添加了 segue(带有显示名称)并且它在我通常使用 select 单元格时有效。请帮助我。

    AppDelegate
  func application(application: UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: ([AnyObject]?) -> Void) -> Bool {
        if userActivity.activityType == CSSearchableItemActionType {
            if let identifier = userActivity.userInfo?[CSSearchableItemActivityIdentifier] as? String {
                print(identifier)
                checkWord = identifier // checkWord is String

                let tableC = TableViewController()
                tableC.showData()

                return true
            }
        }
        return false
    }


  func showData() {
    let matchString = appDel.checkWord
    if mainArray.contains(matchString) {
        let ind = mainArray.indexOf(matchString)!

        let indexPathMain = NSIndexPath(forItem: ind, inSection: 0)
        print(indexPathMain)
        self.tableView.selectRowAtIndexPath(indexPathMain, animated: true, scrollPosition: UITableViewScrollPosition.None)

        performSegueWithIdentifier("show", sender: nil)
        print("Show data")
    }
}

如果您没有实施 willContinueUserActivityWithType 或者如果它 return 为 false,则意味着 iOS 应该处理 activity。在这种情况下,它可以显示 UIAlertController。因此,要在此委托调用中为您的 activity 消除此警告 return true:

func application(application: UIApplication, willContinueUserActivityWithType userActivityType: String) -> Bool { return true }