-1

Giving error when trying to hide tab bar item

-[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

Hemang
  • 26,840
  • 19
  • 119
  • 186
Pradumna Patil
  • 2,180
  • 3
  • 17
  • 46

1 Answers1

2

The hidden property is present on UIView and its subclasses. UITabBarItem is not a subclass of UIView. It's a subclass of UIBarItem, which inherits from NSObject.

Trying to call the selector setHidden: on an instance of UITabBarItem will cause it to crash, given it doesn't have a method to handle that.

Cezar
  • 55,636
  • 19
  • 86
  • 87