UITabBar 项目隐藏错误

UITabBar item hiding error

尝试隐藏标签栏项目时出错

-[UITabBarItem setHidden:]: unrecognized selector sent to instance

0 CoreFoundation 0x0493cdf6 exceptionPreprocess + 182 1 libobjc.A.dylib 0x03fe4837 objc_exception_throw + 44 2 CoreFoundation
0x04944a75 -[NSObject(NSObject) doesNotRecognizeSelector:] + 277 3
CoreFoundation 0x0488d9c7 ___forwarding_
+ 1047 4 CoreFoundation 0x0488d58e _CF_forwarding_prep_0 + 14 5 SkyDroid-Pro 0x00116037 -[tabBarAppAppDelegate application:didFinishLaunchingWithOptions:] + 279 6 UIKit
0x00a8c47c -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 291 7 UIKit 0x00a8d187 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 2869 8 UIKit 0x00a906df -[UIApplication _runWithMainScene:transitionContext:completion:] + 1639 9 UIKit 0x00aa9410 84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke + 59 10 UIKit 0x00a8f2eb -[UIApplication workspaceDidEndTransaction:] + 155 11 FrontBoardServices 0x0525ffee __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71 12 FrontBoardServices
0x0525fc34 __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54 13 FrontBoardServices 0x05271775 __31-[FBSSerialQueue performAsync:]_block_invoke + 26 14 CoreFoundation 0x048607a0 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK
+ 16 15 CoreFoundation 0x048560b3 __CFRunLoopDoBlocks + 195 16 CoreFoundation
0x04855f0b __CFRunLoopRun + 2715 17 CoreFoundation
0x048551ab CFRunLoopRunSpecific + 443 18 CoreFoundation
0x04854fdb CFRunLoopRunInMode + 123 19 UIKit
0x00a8ecb0 -[UIApplication _run] + 571 20 UIKit
0x00a92386 UIApplicationMain + 1526 21 SkyDroid-Pro
0x00115efc main + 76 22 libdyld.dylib
0x04320ac9 start + 1

hidden 属性 存在于 UIView 及其子类中。 UITabBarItem 不是 UIView 的子类。它是 UIBarItem 的子类,继承自 NSObject.

尝试在 UITabBarItem 的实例上调用选择器 setHidden: 会导致它崩溃,因为它没有处理该问题的方法。