将按钮添加到本机工具栏

Add a button to the native toolbar

我有以下代码

final class MyViewController: UIViewController, 
    UICollectionViewDataSource, UICollectionViewDelegate, /*..*/ {

    //
    // Declaring local variables, other controllers and delegates etc.
    //

    override func viewDidLoad() {
        super.viewDidLoad()

        let item = UIBarButtonItem(title: "A button that should do nothing", 
            style: .Plain, target: nil, action: nil)

        self.navigationController!.toolbar.items = [item]

        self.navigationController!.toolbarHidden = false
    }

    // the rest of my code
}

无论我做什么,工具栏都会出现,但其中不会呈现任何内容。

我也试过了

self.navigationController?.toolbarItems?.insert(item, atIndex: 0)

做项目的插入,但仍然没有运气。

我做错了什么?

已通过

添加项目修复
self.toolbarItems = [item]