【问题标题】:Xcode module import errorsXcode 模块导入错误
【发布时间】:2014-11-23 23:10:57
【问题描述】:

我正在尝试将 AMBubbleTableViewController 模块添加到我的应用 (https://github.com/andreamazz/AMBubbleTableView),并按照说明进行操作,但出现了很多错误,我不知道为什么。

这些是错误,知道吗?

Undefined symbols for architecture x86_64:


"_AMOptionsBubbleDetectionType", referenced from:
      -[Chat viewDidLoad] in Chat.o
  "_AMOptionsBubblePressEnabled", referenced from:
      -[Chat viewDidLoad] in Chat.o
  "_AMOptionsBubbleSwipeEnabled", referenced from:
      -[Chat viewDidLoad] in Chat.o
  "_OBJC_CLASS_$_AMBubbleTableViewController", referenced from:
      _OBJC_CLASS_$_Chat in Chat.o
  "_OBJC_METACLASS_$_AMBubbleTableViewController", referenced from:
      _OBJC_METACLASS_$_Chat in Chat.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

还有我的代码:

- (void)viewDidLoad {
// Bubble Table setup

[self setDataSource:self]; // Weird, uh?
[self setDelegate:self];
[self setTitle:@"Chat"];

// Dummy data
self.data = [[NSMutableArray alloc] initWithArray:@[
                                                    @{
                                                        @"text": @"He felt that his whole life was some kind of dream and he sometimes wondered whose it was and whether they were enjoying it.",
                                                        @"date": [NSDate date],
                                                        @"type": @(AMBubbleCellReceived),
                                                        @"username": @"Stevie",
                                                        @"color": [UIColor redColor]
                                                        },
                                                    @{
                                                        @"text": @"My dad isn’t famous. My dad plays jazz. You can’t get famous playing jazz",
                                                        @"date": [NSDate date],
                                                        @"type": @(AMBubbleCellSent)
                                                        },
                                                    @{
                                                        @"date": [NSDate date],
                                                        @"type": @(AMBubbleCellTimestamp)
                                                        },
                                                    @{
                                                        @"text": @"I'd far rather be happy than right any day.",
                                                        @"date": [NSDate date],
                                                        @"type": @(AMBubbleCellReceived),
                                                        @"username": @"John",
                                                        @"color": [UIColor orangeColor]
                                                        },
                                                    @{
                                                        @"text": @"The only reason for walking into the jaws of Death is so's you can steal His gold teeth.",
                                                        @"date": [NSDate date],
                                                        @"type": @(AMBubbleCellSent)
                                                        },
                                                    @{
                                                        @"text": @"The gods had a habit of going round to atheists' houses and smashing their windows.",
                                                        @"date": [NSDate date],
                                                        @"type": @(AMBubbleCellReceived),
                                                        @"username": @"Jimi",
                                                        @"color": [UIColor blueColor]
                                                        },
                                                    @{
                                                        @"text": @"you are lucky. Your friend is going to meet Bel-Shamharoth. You will only die.",
                                                        @"date": [NSDate date],
                                                        @"type": @(AMBubbleCellSent)
                                                        },
                                                    @{
                                                        @"text": @"Guess the quotes!",
                                                        @"date": [NSDate date],
                                                        @"type": @(AMBubbleCellSent)
                                                        },
                                                    ]
             ];

// Set a style
[self setTableStyle:AMBubbleTableStyleFlat];

[self setBubbleTableOptions:@{AMOptionsBubbleDetectionType: @(UIDataDetectorTypeAll),
                              AMOptionsBubblePressEnabled: @NO,
                              AMOptionsBubbleSwipeEnabled: @NO}];

// Call super after setting up the options
[super viewDidLoad];

[self.tableView setContentInset:UIEdgeInsetsMake(64, 0, 0, 0)];

}

【问题讨论】:

  • 这是一个链接器错误,因为符号和类定义未包含在任何正在编译的源文件中。确保 Compile Sources 构建阶段包含 AMBubbleTableViewController.mAMBubbleGlobals.m 文件。
  • 谢谢!!问题已解决。我需要修复更多的东西,但它解决了问题。再次感谢!
  • 如果此评论有助于解决您的问题,请接受以下答案。

标签: ios xcode chat messages


【解决方案1】:

当包含您正在使用的特定定义的源文件没有被编译时,您经常会看到这种链接器错误,尽管它们的声明位于您正在导入的头文件中。

您可以通过将适当的源文件添加到项目的“编译源”构建阶段来解决此问题。

在这种特殊情况下,您需要包含AMBubbleTableViewController.mAMBubbleGlobals.m 文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-01-15
    • 2012-07-14
    • 2023-03-03
    • 2017-12-26
    • 2015-08-24
    • 2016-06-24
    • 2015-01-27
    相关资源
    最近更新 更多