我正在使用AFNetworking收到编译器警告,但事实并非如此。我如何解决它? [英] I'm getting compiler warnings with AFNetworking, but shouldn't be. How do I fix it?

查看:100
本文介绍了我正在使用AFNetworking收到编译器警告,但事实并非如此。我如何解决它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个当前要升级到iOS 6的项目中使用了最出色的 AFNetworking 库。我正在升级中,苦苦挣扎在针对iOS 6 SDK进行编译时收到的一堆警告。

I'm using the most excellent AFNetworking library in a project that I'm currently upgrading to iOS 6. I'm in the middle of the upgrade, whittling down the bunch of warnings that I get when compiling against the iOS 6 SDK.

SystemConfiguration framework not found in project, or not included in
precompiled header. Network reachability functionality will not be available.

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 文件。我怀疑Xcode很傻。公认这是一件小事,但是在周围留下警告是不好的做法。

Here's the thing, though: those two libraries are added in all my targets. I'd like to get rid of those warnings the proper way; I won't modify the AFNetworking files. I suspect it's Xcode being silly. It's admittedly a small thing, but leaving warnings around is bad practice.

如何删除这些警告?

我尝试重新启动Xcode并进行清理。两者都不起作用。

I've tried restarting Xcode and cleaning. Both don't work.

推荐答案

我不确定您是否正在使用CocoaPods ,但这是在AFNetworking Github页面上跟踪的已知问题 a>。

I'm not sure if you're using CocoaPods or not but this is a known issue being tracked on the AFNetworking Github page.

我能够通过将正确的import语句直接添加到我的`PROJECTNAME-Prefix.pch中来解决此问题,在那里我将其更改为此。

I was able to fix this by adding the correct import statements directly to my `PROJECTNAME-Prefix.pch there I changed it to this.

#ifdef __OBJC__
  #import <UIKit/UIKit.h>
  #import <SystemConfiguration/SystemConfiguration.h>
  #import <MobileCoreServices/MobileCoreServices.h>
#endif

如果还有其他内容,请勿将其删除。只需添加SystemConfiguration和MobileCoreServices的导入。

If you have something else in there don't delete it. Just add the imports for SystemConfiguration and MobileCoreServices.

对于OS X:

#ifdef __OBJC__
    #import <Cocoa/Cocoa.h>
    #import <SystemConfiguration/SystemConfiguration.h>
    #import <CoreServices/CoreServices.h>
#endif

这篇关于我正在使用AFNetworking收到编译器警告,但事实并非如此。我如何解决它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆