在使用AFNetworking框架时会看到有如下告警:
#warning SystemConfiguration framework not found in project, or not included in precompiled header. Network reachability functionality will not be available.
#warning MobileCoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available.
AFNetworking可选的依赖SystemConfiguration框架来进行网络可达性监测,依赖MobileCoreServices对上传文件进行MIME类型检测。如果没有包含这两个框架或者没有在预编译头文件中包括就会有上述告警.
解决方法为:
- 在项目中增加SystemConfiguration和MobileCoreServices框架(对应Mac OS X,则为CoreServices).
- 在项目的预编译头文件Prefix.pch中增加对应的头文件
#import <SystemConfiguration/SystemConfiguration.h> #import <MobileCoreServices/MobileCoreServices.h> //or #import <CoreServices/CoreServices> for Mac OS X
参考:
Warning about missing SystemConfiguration and CoreServices on iOS
AFNetworking FAQ