Firebase,Swift:与返回类型冲突的可空性说明符,与现有说明符'nonnull'的'可空'冲突 [英] Firebase, Swift : Conflicting nullability specifier on return types, 'nullable' conflicts with existing specifier 'nonnull'

查看:426
本文介绍了Firebase,Swift:与返回类型冲突的可空性说明符,与现有说明符'nonnull'的'可空'冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firebase 3.6.0 中的警告。 Xcode 8 - Swift 3。

这些是Firebase类: -


  • @class FIROptions

  • @class FIRAuthCredential $ b $ li $ @class FIRUserProfileChangeRequest



警告消息:
$ b



  • (可为null的实例类型) init NS_UNAVAILABLE;

想象一下它可能是一个bug!如果没有,如何解决这个问题的任何想法?

$ b 原始答案:这个问题对我来说是最新的Firebase(3.7.1)。只需做一个pod更新Firebase,然后清理您的项目(通过Option键清理生成文件夹就可以了)。



更新的答案 :不,我的坏...这个问题依然存在。



进一步挖掘,这里有一个很好的解释: https://stackoverflow.com/a/39233507/3638762



同时(因为我感觉不好得到你的希望了)我找到了一个很好的方法来压制警告。我不得不猜测无效性警告类型。 ; - )



在Pods / FirebaseCore / Frameworks / FirebaseCore.framework / Headers / FIRApp.h中添加以下三条#pragma线:

  #pragma clang diagnostic push 
#pragma clang diagnostic ignored-Wnullability
- (可为null的实例类型)init NS_UNAVAILABLE;
#pragma clang diagnostic pop

干杯!


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?

解决方案

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!

这篇关于Firebase,Swift:与返回类型冲突的可空性说明符,与现有说明符'nonnull'的'可空'冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆