hi,我刚刚更新了我的Dropbox api,但我认为这不应该导致这个问题但是在更新之后我正在我的项目中使用xcode 9.2构建它。知道怎么摆脱这个警告吗?
找到了多个名为'count'的方法
请查看方法调用的代码和附加截图。
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return [[thumbImagesCollectionArray objectAtIndex:collectionView.tag-1] count];
}
在给[thumbImagesCollectionArray objectAtIndex:collectionView.tag-1]
打电话之前,你应该把NSMutableArray
投到count
。
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
[(NSMutableArray *)[thumbImagesCollectionArray objectAtIndex:collectionView.tag-1] count];
}
据我所知,在编译时,调用[thumbImagesCollectionArray objectAtIndex:collectionView.tag-1]
时返回的对象类型是未知的。而且它不知道应该在这个对象上调用什么count
方法。这就是为什么我们有警告。
要修复它,将对象返回到NSMutableArray
,以便编译器知道应该调用什么方法。