【问题标题】:Importing .h causes Duplicate Symbol Crash iOS导入 .h 导致重复符号崩溃 iOS
【发布时间】:2015-08-18 19:52:59
【问题描述】:

我试图在我的 iOS 应用程序中将字符串从一个类传递到另一个类。我是这样设置的:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // open a alert with an OK and cancel button
    Vimeo *vimeo= [[[Vimeo alloc] initWithNibName:@"Vimeo" bundle:[NSBundle mainBundle]] autorelease];
    [self.navigationController pushViewController:vimeo animated:YES];
    UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
    vimeo.feedAddress = selectedCell.textLabel.text;


}

如果我不这样做

#import "Vimeo.h"

在这个类的实现中,我得到一个错误,它在 Vimeo 中找不到属性 feedAddress。如果我导入它,该错误就会消失,但在运行时,我会收到重复符号错误。

发生了什么事?

【问题讨论】:

  • 查找您意外导入 .m 文件的位置。
  • 用有关重复符号链接错误的详细信息更新您的问题。并发布有问题的 .h 文件。很可能您错误地声明了一个全局变量。

标签: ios import


【解决方案1】:

确保您的项目中没有两个名为 Vimeo.h 的文件,或者您没有两个 Vimeo 类的声明

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-01
    相关资源
    最近更新 更多