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

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

问题描述

我从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;

}

但我想了解为什么连接将不工作,什么错误消息的意思。现在这看起来像是一个kludge对我,因为我使用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天全站免登陆