Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase, Swift : Conflicting nullability specifier on return types, 'nullable' conflicts with existing specifier 'nonnull'

Tags:

Warning's in Firebase 3.6.0. Xcode 8 - Swift 3.

These are the Firebase classes:-

  • @class FIROptions
  • @class FIRAuthCredential
  • @class FIRUserProfileChangeRequest

Warning message:

  • (nullable instancetype)init NS_UNAVAILABLE;

Figured it might be a bug!.

But if not, any ideas to how to fix it?

like image 858
Dravidian Avatar asked Sep 19 '16 01:09

Dravidian


1 Answers

Original answer: This problem is fixed for me as of the latest Firebase (3.7.1). Just do a "pod update Firebase" and then Clean your project (Clean Build Folder via Option key just to be sure).

Updated answer: Nope, my bad... the problem remains for me too.

Digging further, there's a good explanation here: https://stackoverflow.com/a/39233507/3638762

In the meantime (since I felt bad about getting your hopes up) I found a nice way to suppress the warning. I had to guess at the -Wnullability warning type. ;-)

Add these three #pragma lines around the offending line in Pods/FirebaseCore/Frameworks/FirebaseCore.framework/Headers/FIRApp.h:

#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability" - (nullable instancetype)init NS_UNAVAILABLE; #pragma clang diagnostic pop 

Cheers!

like image 92
warby Avatar answered Nov 09 '22 23:11

warby