“无法编译连接:"是什么意思?错误是什么意思? [英] What does the "Couldn't compile connection:" error mean?

查看:44
本文介绍了“无法编译连接:"是什么意思?错误是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 Xcode 收到以下错误:

I'm getting the following error from Xcode:

Couldn't compile connection: <IBCocoaTouchOutletConnection:0x401538380
<IBProxyObject: 0x40154a260> => categoryPicker => <IBUIPickerView: 0x4016de1e0>>

我已将其缩小到故事板中的单个插座连接.我的代码(大约 30 个带有许多其他连接的视图)编译并运行良好,直到我将连接从 UIPicker 添加到视图的 categoryPicker 属性.选择器本身也可以正常工作,我只是无法在没有使此连接正常工作的情况下重新加载它:

I've narrowed this down to a single outlet connection in storyboard. My code (about 30 views with lots of other connections) compiles and runs fine until I add a connection from a UIPicker to the view's categoryPicker property. The picker itself also works fine, I just can't reload it without getting this connection to work:

@interface FiltersTableViewController : UITableViewController <UIPickerViewDataSource, UIPickerViewDelegate> {
    NSFetchedResultsController *fetchedResultsController;
    FilterTableViewController *filterView;

    AppDelegate *appDelegate;
    NSManagedObjectContext *managedObjectContext;       
}

@property (nonatomic, strong) FilterTableViewController *filterView;
@property (nonatomic, strong) NSFetchedResultsController *fetchedResultsController;
@property (nonatomic, strong) NSManagedObjectContext *managedObjectContext;

@property (nonatomic, weak) IBOutlet UIPickerView *categoryPicker;

- (void)configureCell:(FilterTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath;
- (void)performFetch;

@end

UIPickerView 位于 UITableViewCell 中.这是故事板的图像,从categoryPicker"到FiltersTableViewController"的连接导致错误:

The UIPickerView is in a UITableViewCell. Here's an image of the storyboard, the connection from "categoryPicker" to "FiltersTableViewController" causes the error:

感谢您提供有关如何调试它的任何想法或建议!

Thanks for any ideas, or suggestions on how to debug it!

我删除了连接并向 numberOfComponentsInPickerView 添加了一行:

I removed the connection and added one line to numberOfComponentsInPickerView:

- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {

    categoryPicker = pickerView;

    return 1;

}

现在可以了!但我想了解为什么连接不起作用以及该错误消息的含义.现在这对我来说似乎很麻烦,因为我在其他任何地方都使用 IB 连接来获取对象引用.

This now works!, but I'd like to understand why the connection won't work and what that error message means. Right now this seems like a kludge to me since I use IB connections everywhere else to get object references.

编辑 2:连接原型单元会产生以下错误:非法配置:连接单元"不能将原型对象作为其目的地.不确定这是否是 Xcode 4.5 中的新功能.

EDIT 2: Connecting a prototype cell generates this error: Illegal Configuration: Connection "Cell" cannot have a prototype object as its destination. Not sure if this is new in Xcode 4.5.

推荐答案

问题在于这是一个原型单元格.在其中有一个出口是没有意义的,因为它不是一个真正的细胞:它是一个模型,可能有几十个或数百个细胞,在这种情况下,出口指向哪个?

The problem is that this is a prototype cell. It is meaningless to have an outlet to something in it, because it isn't a real cell: it's a model for what might be dozens or hundreds of cells, and which one would the outlet point to in that case?

这篇关于“无法编译连接:"是什么意思?错误是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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