age*_*ped 31 xcode afnetworking
我正在使用AFNetworking我目前正在升级到iOS 6的项目中最优秀的库.我正处于升级过程中,减少了在针对iOS 6 SDK进行编译时收到的一堆警告.
SystemConfiguration framework not found in project, or not included in
precompiled header. Network reachability functionality will not be available.
Run Code Online (Sandbox Code Playgroud)
和
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.
Run Code Online (Sandbox Code Playgroud)
但事情就是这样:我的所有这些libraries 都被加入了targets.我想以正确的方式摆脱那些警告; 我不会修改AFNetworking文件.我怀疑这是Xcode很傻.这无疑是一件小事,但留下警告是不好的做法.
我该如何删除这些警告?
我试过重启Xcode和清理.两者都不起作用.
Kei*_*ley 75
我不确定你是否使用CocoaPods,但这是在AFNetworking Github页面上跟踪的已知问题.
我能够通过将正确的import语句直接添加到我的`PROJECTNAME-Prefix.pch来解决这个问题,我将其更改为此.
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#endif
Run Code Online (Sandbox Code Playgroud)
如果你有其他东西,不要删除它.只需添加SystemConfiguration和MobileCoreServices的导入.
对于OS X:
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <CoreServices/CoreServices.h>
#endif
Run Code Online (Sandbox Code Playgroud)
Mik*_*ers 14
如果你正在使用swift:Xcode在编译Prefix.pch文件之前编译Swift代码,那么即使你的.pch文件中有正确的导入,你也会得到这些警告.我发现的最佳解决方案是Bridging-Header.h在导入AFNetworking之前将它们添加到项目的文件中:
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
#import "AFNetworking.h"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14570 次 |
| 最近记录: |