Ios 试图在视图控制器解除分配时加载视图控制器的视图。核心聚光灯

Ios 试图在视图控制器解除分配时加载视图控制器的视图。核心聚光灯,ios,swift2,uistoryboardsegue,corespotlight,Ios,Swift2,Uistoryboardsegue,Corespotlight,我在我的应用程序中集成了corepotlight。我希望用户在spotlight search中找到所需信息,然后用户在spotlight中打开此信息,信息将在DetailViewController中打开。我做到了,spotlight工作得很好,但当应用程序打开时,我看到此错误在视图控制器解除分配时尝试加载视图控制器是不允许的,并且可能会导致未定义的行为(UIAlertController:0x1245a0560),尽管我没有使用UIAlertController。我在AppDelegate

我在我的应用程序中集成了
corepotlight
。我希望用户在spotlight search中找到所需信息,然后用户在spotlight中打开此信息,信息将在
DetailViewController
中打开。我做到了,spotlight工作得很好,但当应用程序打开时,我看到此错误在视图控制器解除分配时尝试加载视图控制器是不允许的,并且可能会导致未定义的行为(UIAlertController:0x1245a0560),尽管我没有使用
UIAlertController
。我在AppDelegate func中创建了一个函数,该函数调用UITableViewController的函数,该函数必须通过索引打开对象。但事实并非如此。showData()
performsguewithidentifier(“show”,发送方:nil)中仍然存在错误。
原因:“接收方()没有标识符为“show”的序列。。虽然我添加了segue(带有show name)并且它在我通常选择cell时工作。请帮帮我

    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,或者如果它返回false,则意味着iOS应该处理活动。在这种情况下,它可以显示UIAlertController。因此,要消除此警告,请在此委托调用中为您的活动返回true:

func应用程序(应用程序:UIApplication、,
WillContinueUserActivityType:String)->Bool{
返回真值
}

如果您没有实现willContinueUserActivityWithType,或者如果返回false,则表示iOS应该处理活动。在这种情况下,它可以显示UIAlertController。因此,要消除此警告,请在此委托调用中为您的活动返回true:

func应用程序(应用程序:UIApplication、,
WillContinueUserActivityType:String)->Bool{
返回真值
}