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
Asked
Active
Viewed 153 times
0
-
Can you show some of the code and error screenshots – Code cracker Jan 24 '22 at 09:33
-
@Larme it does not work – reccoon tech Jan 24 '22 at 09:55
1 Answers
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