0

我正在尝试使用 NSMutableDictionary 来存储 4 次触摸的 X 和 Y 值,如 Apple 的事件处理指南(http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/简介/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)

有人对我可能做错的事情有任何建议吗?

谢谢!

4

1 回答 1

1

替换CFMutableDictionaryGetValueCFDictionaryGetValue。这个CFMutableDictionaryGetValue功能对我来说似乎很奇怪。我认为它不存在

于 2013-08-01T13:16:54.220 回答