Ios 应用被拒绝:在iPad2.10上崩溃。无法复制错误

Ios 应用被拒绝:在iPad2.10上崩溃。无法复制错误,ios,iphone,swift,crash,crash-reports,Ios,Iphone,Swift,Crash,Crash Reports,最近,我的应用程序被苹果公司拒绝,因为它违反了苹果公司2.10版的规定 -----2.10----- 我们发现你的应用程序在iPad上崩溃了,这不符合应用商店审查指南要求的在iPad上运行的要求 苹果公司已经给我发送了应用程序的崩溃日志,但我不知道如何解释它们。崩溃日志如下所示: 编辑: 我已设法将崩溃日志符号化,如下所示: 以下是导致错误的特定函数的源代码: func tableView(tableView: UITableView, numberOfRowsInSection sectio

最近,我的应用程序被苹果公司拒绝,因为它违反了苹果公司2.10版的规定

-----2.10-----

我们发现你的应用程序在iPad上崩溃了,这不符合应用商店审查指南要求的在iPad上运行的要求

苹果公司已经给我发送了应用程序的崩溃日志,但我不知道如何解释它们。崩溃日志如下所示:

编辑:

我已设法将崩溃日志符号化,如下所示:

以下是导致错误的特定函数的源代码:

func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    // Return the number of rows in the section.

    if let numberOfFetchedObjects = fetchedResultsController.fetchedObjects?.count {
            return numberOfFetchedObjects

        }

    else {return 0}
}
以下是视图控制器上与tableView和fetchedResultsController相关的其余代码:

 override func viewDidLoad() {
    super.viewDidLoad()


    setupFetchedResultsControllerAndDelegate()
    fetchResults()


    self.adBanner.delegate = self

    self.goalTableView.allowsSelectionDuringEditing = true
    self.goalTableView.rowHeight = CGFloat(90.0)



    //check if theres a local notification payload
    let appDelegate = UIApplication.sharedApplication().delegate! as AppDelegate

    if let notification = appDelegate.localNotificationToPass {
        self.performFollowUpActionForNotification(notification)
        appDelegate.localNotificationToPass = nil
    }


    //check if theres a need to present rate app alert
    if appDelegate.goalPageShouldShowAlert == true {
        self.showRateAppAlert()
    }

}

//MARK: - Fetched Results Controller Set Up & Helper Methods

func setupFetchedResultsControllerAndDelegate() {


    //initialize fetch request
    let fetchRequest:NSFetchRequest = NSFetchRequest(entityName: "Goal")

    //initialize predicate
    let predicate:NSPredicate = NSPredicate(format:"isDone == %@", false)!
    fetchRequest.predicate = predicate

    //set sort descriptor
    let sortDescriptor:NSSortDescriptor = NSSortDescriptor(key: "dateCreated", ascending: true)
    fetchRequest.sortDescriptors = [sortDescriptor]

    //set up fetched results controller variable
    fetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: context, sectionNameKeyPath: nil, cacheName: nil)

    fetchedResultsController.delegate = self
}

func fetchResults() {
    var error = NSErrorPointer()

    if !fetchedResultsController.performFetch(error) {
        //MARK: replace the print line function below to an alert for consumers later on
        println("Could not fetch results \n with error: \(error)")
    }
}



 func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell:GoalCell! = tableView.dequeueReusableCellWithIdentifier("goalCell", forIndexPath: indexPath) as GoalCell
    configureCell(cell, atIndexPath: indexPath, forViewController: self)

    return cell
}

func configureCell(cell:GoalCell, atIndexPath indexPath: NSIndexPath, forViewController viewController:UIViewController){

    var fetchedGoals = self.fetchedResultsController.fetchedObjects as [Goal]

    let cellGoal = fetchedGoals[indexPath.row]


    cell.goalNameLabel.text = cellGoal.name

    cell.goalDatelineLabel.text = Goal.convertGoalDueDateToString(cellGoal)

    cell.parentViewController = self

    cell.clipsToBounds = true





}

// Override to support conditional editing of the table view.
func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
    // Return NO if you do not want the specified item to be editable.
    return true
}

func tableView(tableView: UITableView, editingStyleForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCellEditingStyle {
    return UITableViewCellEditingStyle.Delete
}



func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
    if editingStyle == .Delete {

        let goal:Goal = fetchedResultsController.fetchedObjects![indexPath.row] as Goal
        self.context.deleteObject(goal)
        self.cancelNotificationForGoal(goal)

        var error = NSErrorPointer()
        self.context.save(error)
    }


}

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

    if self.goalTableView.editing == true {
        self.performSegueWithIdentifier("addOrEditGoal", sender: self)
    }


    else {
        self.performSegueWithIdentifier("showGoalDetailView", sender: self)
    }
}


func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
    cell.backgroundColor = UIColor.clearColor()
}


func tableView(tableView: UITableView, willBeginEditingRowAtIndexPath indexPath: NSIndexPath) {
    self.setEditingForVC()
}

func tableView(tableView: UITableView, didEndEditingRowAtIndexPath indexPath: NSIndexPath) {
    if self.goalTableView.editing == false {
        self.changeDoneButtonToEdit()
    }
}

//MARK: - Fetched Results Controller Delegate Protocol Methods
func controllerWillChangeContent(controller: NSFetchedResultsController) {
    self.goalTableView.beginUpdates()
}

func controllerDidChangeContent(controller: NSFetchedResultsController) {
    self.showOrHideEmptyTableViewLabel()
    self.goalTableView.endUpdates()
}

func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {

    switch type {
    case NSFetchedResultsChangeType.Insert :
        self.goalTableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: UITableViewRowAnimation.Fade)
    case NSFetchedResultsChangeType.Delete :
        self.goalTableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: UITableViewRowAnimation.Fade)
    case NSFetchedResultsChangeType.Update:
        self.configureCell((self.goalTableView.cellForRowAtIndexPath(indexPath!) as GoalCell), atIndexPath: indexPath!, forViewController: self)
    case NSFetchedResultsChangeType.Move:

        self.goalTableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: UITableViewRowAnimation.Fade)
        self.goalTableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: UITableViewRowAnimation.Fade)

    }
}


 //MARK: - ADBannerViewDelegate

func bannerViewActionShouldBegin(banner: ADBannerView!, willLeaveApplication willLeave: Bool) -> Bool {
    //if will leave is true, it means the ad might take the user to another app or window.
    if willLeave == true {
        let error = NSErrorPointer()
        self.context.save(error)

        return true
    }

    else {return true}
}

func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError error: NSError!) {

    banner.hidden = true
    self.tableViewBottomConstraint.constant = 0

    self.goalTableView.layoutIfNeeded()
}

func bannerViewDidLoadAd(banner: ADBannerView!) {

    banner.hidden = false
    self.tableViewBottomConstraint.constant = banner.frame.height
    self.goalTableView.layoutIfNeeded()
}

您需要对崩溃报告进行符号化,并查看代码中的断言被抛出的位置。您的应用程序是否有类似于删除表格单元格或更改单元格顺序的内容?不管怎样。@Kerni好的,我去it@Jageen是的,tableView允许deletion@WesleyOw我有强烈的感觉,问题就在那个屏幕上,在那个屏幕上做测试,就像有一个单元格并执行删除。(在我的例子中,出现了一个问题,比如当我删除单元格时,它将选择另一个单元格并执行某些操作,然后应用程序崩溃)。