您的位置:首页 > Web前端

AFNetworking报错"_UTTypeCopyPreferredTagWithClass", referenced from: _AFContentTypeForPathExtens

2017-10-25 15:26 507 查看
问题:

最近在原来项目中用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 都不会报错。这和工程的配置有关。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐