UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

The code in the article titled 'How to Add a Toolbar to the Keyboard' contains errors

Forums > SwiftUI

⚠️ Please check your code before presenting. ⚠️

https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-toolbar-to-the-keyboard

When you don't know, this approach may contain some bugs:

Error 1:

-[RTIInputSystemClient remoteTextInputSessionWithID:performInputOperation:] perform input operation requires a valid sessionID

Error 2:

Problem with constraints looks like:

Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) ( "<NSAutoresizingMaskLayoutConstraint:0x60000213ecb0 h=--& v=--& _UIToolbarContentView:0x107e1d7b0.width == 0 (active)>", "<NSLayoutConstraint:0x6000021659a0 H:|-(0)-[_UIButtonBarStackView:0x107d337d0] (active, names: '|':_UIToolbarContentView:0x107e1d7b0 )>", "<NSLayoutConstraint:0x6000021659f0 H:[_UIButtonBarStackView:0x107d337d0]-(20)-| (active, names: '|':_UIToolbarContentView:0x107e1d7b0 )>" )

Will attempt to recover by breaking constraint <NSLayoutConstraint:0x6000021659f0 H:[_UIButtonBarStackView:0x107d337d0]-(20)-| (active, names: '|':_UIToolbarContentView:0x107e1d7b0 )>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. AddInstanceForFactory: No factory registered for id <CFUUID 0x60000023cc00> F8BB1C28-BAE8-11D6-9C31-00039315CD46 127491 HALC_ProxyIOContext.cpp:1328 HALC_ProxyIOContext::IOWorkLoop: skipping cycle due to overload

⚠️ Please check your code before presenting. ⚠️

   

I think you will find that this is NOT and error but Log Noise.

Does it proform as expected? Yes, it prints "Clicked"

 ⚠️Please check the error before posting⚠️

1      

Error 2 appears to relate to a UIKit view, not a SwiftUI view.

Are you erroneously following a SwiftUI toolbar tutorial when your app is UIKit, not SwiftUI?

   

Hacking with Swift is sponsored by RevenueCat.

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.