转自: http://blog.csdn.net/boyqicheng/article/details/51363047#comments
问题:
本来一直使用Pods安装AFNetworking, 但是最近接口对于错误码的处理是,当请求失败(404,500)时,也会返回信息,所以为了达到这种效果,就只有去修改AF的源码,所以准备手动配置AF, 就过就遇到下面的错误:
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 都不会报错。这和工程的配置有关。
问题:
本来一直使用Pods安装AFNetworking, 但是最近接口对于错误码的处理是,当请求失败(404,500)时,也会返回信息,所以为了达到这种效果,就只有去修改AF的源码,所以准备手动配置AF, 就过就遇到下面的错误:
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 都不会报错。这和工程的配置有关。