Swift / iOS:由于未捕获的异常终止应用程序' NSInternalInconsistencyException'

时间:2015-09-06 05:12:00

标签: ios iphone xcode swift uitableview

我使用来自Github的PageMenu uacaps。我添加了一个UIViewController和一个UITableViewController,并将它的自定义类设置为FrmProfileFrmProfile_Album

UIViewController Custom class

将其设置为初始viewcontroller:

enter image description here

的UIViewController:

UIViewController Custom class

并设置插座:

outlet

FrmProfile.swift:

import UIKit

class FrmProfile: UIViewController {

    // MARK: - Outlets
    @IBOutlet weak var vBase: UIView!

    // MARK: - Vars
    var pageMenu : CAPSPageMenu?

    //MARK: - Functions
    func setPageMenu () {
        var controllerArray : [UIViewController] = []

        let cAlbums : FrmProfile_AlbumList = FrmProfile_AlbumList()
        cAlbums.title = "Albums"
        controllerArray.append(cAlbums)
        let cArticles : FrmProfile_ArticleList = FrmProfile_ArticleList()
        // Customize menu (Optional)
        let parameters: [CAPSPageMenuOption] = [
            .SelectedMenuItemLabelColor(UIColor.blackColor()),
            .ScrollMenuBackgroundColor(UIColor.whiteColor()),
            .ViewBackgroundColor(UIColor.whiteColor()),
            .SelectionIndicatorColor(cblue),
            .BottomMenuHairlineColor(UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0)),
            .MenuHeight(40.0),
            .MenuItemWidth(90.0),
            .CenterMenuItems(true)
        ]

        // Initialize scroll menu
        pageMenu = CAPSPageMenu(viewControllers: controllerArray, frame: CGRectMake(0.0, 96.0, self.view.frame.width, self.view.frame.height - 96), pageMenuOptions: parameters)

        self.addChildViewController(pageMenu!)
        vBase.addSubview(pageMenu!.view)

        pageMenu!.didMoveToParentViewController(self)
    }

    //MARK: - Override functions
    override func viewDidLoad() {
        super.viewDidLoad()
        setPageMenu()
    }
}

FrmProfile_Albums.swift:

import UIKit

class FrmProfile_AlbumList: UITableViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }

    // MARK: - Table view data source
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }

    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 1
    }

    private struct Storyboard {
        static let CellReuseIdentifier = "album"
    }
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCellWithIdentifier(Storyboard.CellReuseIdentifier, forIndexPath: indexPath)
        cell.textLabel?.text = "One album"
        cell.detailTextLabel?.text = "notes"
        return cell
    }
}

我添加了UITableViewCell标识符:

identifier

然后,当我运行我的应用程序时,我收到了这些错误:

  

线程1:信号SIGABRT

     

断言失败 - [UITableView dequeueReusableCellWithIdentifier:forIndexPath:],/ BuildRoot / Library / Cache / com.apple.xbs / Sources / UIKit / UIKit-3505.4 / UITableView.m:6540

     

2015-09-06 13:06:32.784 CenterBrain [541:74966] ***由于未捕获的异常终止应用程序' NSInternalInconsistencyException',原因:'无法使用标识符将单元格出列专辑 - 必须为标识符注册一个笔尖或类或在故事板中连接原型单元'

任何人都知道如何解决这个问题?非常感谢!

0 个答案:

没有答案