0

Crash Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UINavigationBarAppearance because no class named UINavigationBarAppearance was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' terminating with uncaught exception of type NSException


1 Answers1

0

UINavigationBarAppearance is only available from iOS 13.

Checkout the documentation here: https://developer.apple.com/documentation/uikit/uinavigationbarappearance

You need to exclude the code using UINavigationBarAppearance for iOS version lower than iOS 13:

if #available(iOS 13.0, *) {
  let navBarAppearance = UINavigationBarAppearance()
  ...
  navigationBarAppearace.standardAppearance = navBarAppearance
} 
Jochen Holzer
  • 1,598
  • 19
  • 25
  • i have added the check in didFinishLaunchingWithOptions but it stills crash – reccoon tech Jan 24 '22 at 10:17
  • *** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UINavigationBarAppearance because no class named UINavigationBarAppearance was found; the class needs to be defined in source code or linked in from a library (ensure the class is part of the correct target)' terminating with uncaught exception of type NSException – reccoon tech Jan 24 '22 at 10:22
  • I don't know what to do now ....I am still facing same crash even after applying check – reccoon tech Jan 24 '22 at 11:17