ios - 编译器错误 - MultiTouchEvents 的 NSMutableDictionary

标签 ios event-handling linker-errors multi-touch

我正在尝试使用 NSMutableDictionary 来存储 4 次触摸的 X 和 Y 值,如 Apple 的事件处理指南 ( http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/Introduction/Introduction.html ) 中所示

我的代码是:

- (void)cacheBeginPointForTouches:(NSSet *)touches {
if ([touches count] > 0) {
    for (UITouch *touch in touches) {
        CGPoint *point = (CGPoint *)CFMutableDictionaryGetValue(_TouchesDict, touch);
        if (point == NULL) {
            point = (CGPoint *)malloc(sizeof(CGPoint));
            CFDictionarySetValue(_TouchesDict, touch, point);
        }
        *point = [touch locationInView:_view.superview];
    }
}
}

但是,我不断收到如下编译器错误:

Undefined symbols for architecture i386:
  "_CFMutableDictionaryGetValue", referenced from:
  -[ViewController cacheBeginPointForTouches:] in ViewController.o
  "_OBJC_IVAR_$_UIViewController._view", referenced from:
  -[ViewController cacheBeginPointForTouches:] in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

有人对我可能做错的事情有什么建议吗?

谢谢!

最佳答案

CFMutableDictionaryGetValue替换为CFDictionaryGetValue。 CFMutableDictionaryGetValue 函数对我来说似乎很奇怪。我认为它不存在

关于ios - 编译器错误 - MultiTouchEvents 的 NSMutableDictionary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17994973/

相关文章:

javascript - 将附加信息传递到事件处理程序中

c++ - 升级到 Xcode 8 后 GCC 5.4 链接器错误

c++ - 什么是 undefined reference /未解析的外部符号错误以及如何修复它?

iphone - 向 Facebook 和 Google+ 好友发送邀请

ios - 给定一个 podspec 文件,我该怎么做才能将它包含在我的项目中?

ios - safari ios 无法打开存折 pkpass

c++ - 如何通过 USB 访问 iPhone 文件系统(从 Windows)

time - Selenium 中 waitForPageToLoad 的替代方案

jquery - 使用关闭按钮扩展 jQuery UI Accordion - 绑定(bind)事件处理程序

c - 重复符号错误 - 全局变量