它是什么意思:“属性类型”JSQMessagesCollectionView"与类型“UICollectionView”不兼容,继承自“UICollectionViewLayout” [英] What does it mean : "Property type "JSQMessagesCollectionView" is incompatible with type "UICollectionView", inherited from "UICollectionViewLayout"

查看:78
本文介绍了它是什么意思:“属性类型”JSQMessagesCollectionView"与类型“UICollectionView”不兼容,继承自“UICollectionViewLayout”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Swift编写一个iOS应用程序,我在Objective C中使用了JSQMessages和JSQSystemSoundPlayer之类的东西。

I'm currently coding an iOS app in Swift, and I use some stuff like JSQMessages and JSQSystemSoundPlayer in Objective C.

当我在我的代码中介绍它们时,我有Xcode 6.2,它工作得很好。
我下载了Xcode 6.3.4以使用Swift 1.2,但现在我有40个警告,如:

When I introduced them in my code, I had the Xcode 6.2, and it worked perfectly. I downloaded Xcode 6.3.4 to use Swift 1.2, but now I have 40 warnings like :

属性类型JSQMessagesCollectionView与类型UICollectionView不兼容,继承自UICollectionViewLayout

"Property type "JSQMessagesCollectionView" is incompatible with type "UICollectionView", inherited from "UICollectionViewLayout""

我已经做了一个桥接标题来调用Objective C文件。

I already made a Bridging Header to call the Objective C files.

非常感谢

推荐答案

以下是对此警告的解释。

Following the comments, here is the explanation of what this warning is.

Xcode 6.3有一个更新的编译器工具链,它更严格,因此你会看到更多的警告,包括这个警告。

Xcode 6.3 has an updated compiler toolchain, which is more strict, thus you are seeing more warnings in general, including this one.

这里,类 JSQMessagesCollectionViewFlowLayout 声明一个属性,其定义与其超类的定义冲突:

Here, the class JSQMessagesCollectionViewFlowLayout declares a property whose definition conflicts with its superclass' definition:

@property (readonly, nonatomic) JSQMessagesCollectionView *collectionView;

然而,在超类中, UICollectionViewLayout ,它声明为:

Whereas, in the superclass, UICollectionViewLayout, it is declared as:

@property(nonatomic, readonly) UICollectionView *collectionView;

目标C不支持属性协方差,此覆盖是Jesse对该语言的错误使用。 JSQMessagesCollectionViewFlowLayout 类应该公开一个属于子类的附加属性。

Objective C does not support property covariance, and this override is an incorrect use of the language by Jesse. The JSQMessagesCollectionViewFlowLayout class should expose an additional property which is of the subclass type.

这篇关于它是什么意思:“属性类型”JSQMessagesCollectionView"与类型“UICollectionView”不兼容,继承自“UICollectionViewLayout”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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