AFNetworking报错"_UTTypeCopyPreferredTagWithClass", referenced from: _AFContentTypeForPathExtens

来源:互联网 发布:做网站需要会编程吗 编辑:程序博客网 时间:2024/05/22 10:38

问题:

最近在原来项目中用MKNetworkKit 实现网络请求,想为了使应用符合AppStore的要求,用AFNetworking3.0+来满足ipv6。导入AFNetworking 和UIKit+AFNetworking 两个文件的时候5处地方报错快哭了

Undefined symbols for architecture x86_64:

  "_UTTypeCopyPreferredTagWithClass", referenced from:

      _AFContentTypeForPathExtension in AFURLRequestSerialization.o

  "_UTTypeCreatePreferredIdentifierForTag", referenced from:

      _AFContentTypeForPathExtension in AFURLRequestSerialization.o

  "_kUTTagClassFilenameExtension", referenced from:

      _AFContentTypeForPathExtension in AFURLRequestSerialization.o

  "_kUTTagClassMIMEType", referenced from:

      _AFContentTypeForPathExtension in AFURLRequestSerialization.o

ld: symbol(s) not found for architecture x86_64

知道是确少.framework 框架。就不知道是哪个.framework。最后找到是未添加 MobileCoreServices.framework(此框架定义统一类型标识符 (UTIs)使用的底层类型


解决:Build Phase ->Link Binary With Libraries()下添加 MobileCoreServices.framework。添加成功后运行程序成功。吐舌头

如果在新建的工程中直接导入AFNetworking 和UIKit+AFNetworking 文件夹是不会报错,即使最低支持版本7.0,Bitcode值为NO,不添加 MobileCoreServices.framework 都不会报错。这和工程的配置有关。

阅读全文
0 0
原创粉丝点击