xcode 7类型参数不能应用于非参数化类
我今天在我的xcode项目中遇到了这个错误…我以前从来没有得到它。 自上次成功构建以来我所做的唯一改变是我导入了iAD框架(我在今天早上尝试进行新构建之前做了这个,所以我不确定它是否与它有任何关系。我尽管如此。)所有问题都与NSSet / NSArray / NSDictionary有关,并且都包含在UIKit的UIEvent和CoreImage的CIImage中。 如果有人知道这里可能会发生什么,我将不胜感激。
编辑:我忘了提到具体的错误。 他们来了:
“类型参数不能应用于非参数化类’NSSet’”,
“类型参数可以应用于非参数化类’NSArray’”,
“类型参数可以应用于非参数化类’NSDictionary’”
编辑2:我没有意识到应用程序商店自动将xcode从6.4更新到7.0,所以我改为标题以反映正确的xcode版本。
这是UIEvent.h中发生的地方(第50,51,52,53,56,59行):
- (nullable NSSet *)allTouches; - (nullable NSSet *)touchesForWindow:(UIWindow *)window; - (nullable NSSet *)touchesForView:(UIView *)view; - (nullable NSSet *)touchesForGestureRecognizer: (UIGestureRecognizer *)gesture NS_AVAILABLE_IOS(3_2); // An array of auxiliary UITouch's for the touch events that did not get delivered for a given main touch. This also includes an auxiliary version of the main touch itself. - (nullable NSArray *)coalescedTouchesForTouch:(UITouch *)touch NS_AVAILABLE_IOS(9_0); // An array of auxiliary UITouch's for touch events that are predicted to occur for a given main touch. These predictions may not exactly match the real behavior of the touch as it moves, so they should be interpreted as an estimate.
这是UIResponder.h中发生的地方(第31-34行):
// Generally, all responders which do custom touch handling should override all four of these methods. // Your responder will receive either touchesEnded:withEvent: or touchesCancelled:withEvent: for each // touch it is handling (those touches it received in touchesBegan:withEvent:). // *** You must handle cancelled touches to ensure correct behavior in your application. Failure to // do so is very likely to lead to incorrect behavior or crashes. - (void)touchesBegan:(NSSet *)touches withEvent:(nullable UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(nullable UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(nullable UIEvent *)event; - (void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event;
也发生在UIREsponder.h(第79行):
@interface UIResponder (UIResponderKeyCommands) @property (nullable,nonatomic,readonly) NSArray *keyCommands NS_AVAILABLE_IOS(7_0); // returns an array of UIKeyCommand objects< @end
这是它在CIImage.h第97行和第102行中发生的地方:
/* Creates a new image from the contents of 'image'. */ + (CIImage *)imageWithCGImage:(CGImageRef)image; + (CIImage *)imageWithCGImage:(CGImageRef)image options:(nullable CI_DICTIONARY(NSString*,id) *)options; /* Creates a new image from the contents of 'layer'. */ + (CIImage *)imageWithCGLayer:(CGLayerRef)layer NS_DEPRECATED_MAC(10_4,10_11); + (CIImage *)imageWithCGLayer:(CGLayerRef)layer options:(nullable CI_DICTIONARY(NSString*,id) *)options NS_DEPRECATED_MAC(10_4,10_11);
我也有这个错误,我只是将@class改为#import用于有问题的类,然后清理并构建,它再次没问题……我认为有些错误……有问题的类是我自己的参数化类。
我重新审视了这个问题,似乎其他人已经在不同的线程和github上解决了这个问题。
问题是我在项目中包含的Parse / Bolts框架已经过时了,我将它们保存在我的项目中。 我在项目中使用的版本与xcode 7冲突。
删除所有本地副本并将“pod’Parse’”添加到我的pod文件并运行“pod install”后,此特定问题已得到解决。
对于有相关问题的任何人,您应该尝试更新项目中剩余的旧的依赖项,并查看为您解决此问题的方法。
以下是一些相关的线程,更详细地讨论了这个问题:
类型参数不能应用于PFAnalytics和PFObject中的非参数化类BFTask
https://github.com/ParsePlatform/Parse-SDK-iOS-OSX/issues/297
- 如何定义哪个button被按下,如果他们都有相同的IBAction?
- 匹配自定义和标准UITableViewCelltypes的左alignment
- 从iOS的twitter获取用户个人资料(尤其是电子邮件地址)
- 务必在UITableViewCell中显示一个UIView
- 如何等待响应和parsing在networkingiOS中完成的XML
- 使UIView和子视图作为一个层而不是单独的半透明
- popoverControllerDidDismissPopover方法不被调用
- 添加/删除或显示/隐藏使用故事板时从UITabbarController的标签栏项目
- iOS表情符号是一项严肃的业务-第2部分:模仿iOS 8.3的表情符号键盘