Xcode9 crashes when adding multiple bar button items to toolbar

Version:


Xcode 9a235


When I drag a toolbar into my view, and then try to add multiple bar button items into the toolbar, if I change one of the bar button items from System Item to "Reply", "Action" or any of those icons, the page hangs forever and I get stuck at a spinning wheel.


Please help!

Replies

Is it OSX or IOS (I guess so) ?

Did it work in XCode 8 ?


When you change one of the bar button items from System Item to "Reply",

what do you change exactly ?

Hi there,


It is OSX (Sierra v10.12.6)


Basically if I have more than 1 button in the toolbar, and I try to change any one of the buttons' icon from the default text "Item", to "reply" (a little back arrow), or "trash" (a trashcan), my computer just hangs.

lilybeans,


Have you found any solution to this? I just ran across this... same Xcode build but with High Sierra.

I have the same problem here. Have never used XCode before so don't have anything to compare it to. Running V9.0. Toolbar works fine if I don't change button types in toolbar, but if I change one to Reply, for example, XCode locks up.

Toolbars are buggy in xcode 9.0. Change flexible space item to fixed or visa versa and xcode exits. Also you can't change the width of UIButton in a toolbar. This all worked in 8.3.3.

This is really frustrating. I submitted a bug report to Apple and got a response that they found no crash. I've tried Xcode 9 on different computers, and even the latest 9.1 beta that was posted yesterday, and all have the same issue.

do you get some crash report ?

Ive got the same issue.

Whenever i choose any bar button and change the system item, it just hangs, with fixed or flexible space.


Im using xcode 9 and Sierra v10.12.6


This IS very annoying...

Same problem here. Was working fine in xcode 8.


Tried with xcode 9 and 9.1 on Sierra 10.12 and High Sierra.


Hope Apple is working on this. As of now xcode 9 is useless.

Same problem here. I'm a new user taking a Udemy course and cannot go any farther in the course until this problem is resolved. For others that reported this problem, what was the actual response back from Apple? I'm using High Sierra 10.13 and Xcode 9.0 ((A235).


Thanks in advance.

Same problem here.Has anyone tried to implement the toolbar/button item programmatically? I'm trying to figure it out as a workaround so I can complete a tutorial. Post code here please.

if you want a work around here is the way to implement the code programatically. note line 25 deomonstrates how to implement a "play" button

override func viewDidLoad() {
        super.viewDidLoad()
       
       
        /
        self.view.backgroundColor = UIColor.black
       
        /
       let myToolbar = UIToolbar(frame: (CGRect(x: 0, y: self.view.bounds.size.height - 44, width: self.view.bounds.size.width, height: 40)))
        /
        myToolbar.layer.position = CGPoint(x: self.view.bounds.width/2, y: self.view.bounds.height-20.0)
       
        /
        myToolbar.barStyle = .blackTranslucent
        myToolbar.tintColor = UIColor.white
        myToolbar.backgroundColor = UIColor.black
       
        /
        let myUIBarButtonGreen: UIBarButtonItem = UIBarButtonItem(title: "Green", style:.plain, target: self, action: #selector(onClickBarButton(sender:)))
        myUIBarButtonGreen.tag = 1
       
        let myUIBarButtonBlue: UIBarButtonItem = UIBarButtonItem(title: "Blue", style:.plain, target: self, action: #selector(onClickBarButton(sender:)))
        myUIBarButtonBlue.tag = 2
       
        let myUIBarButtonRed: UIBarButtonItem = UIBarButtonItem(title: "Red", style: .plain, target: self, action: #selector(onClickBarButton(sender:)))
        myUIBarButtonRed.tag = 3
       
        let myUIBarButtonItemPlay: UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: .play, target: self, action: #selector(onClickBarButton(sender:)))
        myUIBarButtonItemPlay.tag = 4
        /
        myToolbar.items = [myUIBarButtonGreen, myUIBarButtonBlue, myUIBarButtonRed, myUIBarButtonItemPlay]
       
        /
        self.view.addSubview(myToolbar)
    }
   
    @objc func onClickBarButton(sender: UIBarButtonItem) {
       
        switch sender.tag {
        case 1:
            self.view.backgroundColor = UIColor.green
        case 2:
            self.view.backgroundColor = UIColor.blue
        case 3:
            self.view.backgroundColor = UIColor.red
        case 4:
            self.view.backgroundColor = UIColor.white
        default:
            print("ERROR!!")
        }
    }

Wierd. I just tried to get the same error for 'fun' and it happed to me ONCE! Changed button to trash, clicked outside, and it froze! Had to force quit it. Reopened and it went back to before the trash icon. Tried it again, and NO ISSUES!

Your actions didn't work for me. I'm using xcode Version 9.0.1 (9A1004). what version are you using?

Also do you have more that one button item? Try with more that one, if you have not.

Were you able to solve this problem? I am experiencing the same thing right now. I set the tool bar at the bottom of the app, i then insert a bar button item and it crashes.