Ios 多点触控事件的NSMutableDictionary编译器错误
我正在尝试使用NSMutableDictionary来存储4次触摸的X和Y值,如Apple的事件处理指南() 我的代码是:Ios 多点触控事件的NSMutableDictionary编译器错误,ios,event-handling,linker-errors,multi-touch,Ios,Event Handling,Linker Errors,Multi Touch,我正在尝试使用NSMutableDictionary来存储4次触摸的X和Y值,如Apple的事件处理指南() 我的代码是: - (void)cacheBeginPointForTouches:(NSSet *)touches { if ([touches count] > 0) { for (UITouch *touch in touches) { CGPoint *point = (CGPoint *)CFMutableDictionaryGetValue(_To
- (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
函数对我来说似乎很奇怪。我认为它不存在您是否添加了CoreFoundation框架?并导入了此文件的标题framework@Iducool,是的,CoreFoundation框架是addedHi@Toploulou,这克服了其中一个错误(谢谢!),但我仍然得到:架构i386的未定义符号:“\u OBJC\u IVAR\u$\u UIViewController.\u view”,引用自:-[ViewController cacheBeginPointForTouches:]在ViewController.o中找不到架构i386的ld:symbol clang:error:linker命令失败,退出代码为1(使用-v查看调用)