我在iOS 6.0的Xcode 4.5中没有要求的日志消息 [英] Log Messages I didn't asked for in Xcode 4.5 with iOS 6.0

查看:72
本文介绍了我在iOS 6.0的Xcode 4.5中没有要求的日志消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我将Xcode更新到版本4.5并开始为iOS 6构建日志消息,所以不断出现:

since I updated Xcode to Version 4.5 and started building for iOS 6 log messages like this keep appearing:

ADDRESPONSE - ADDING TO MEMORY ONLY

我从未要求过(至少不是有意识地)。

I never asked for that (at least not consciously).

我需要做些什么来阻止这些消息?它们的起源是什么?

What do I need to do to stop these messages ? And what is their origin ?

推荐答案

我遇到了同样的问题,消息是从CFNetwork框架发出的,这个在设备和iOS模拟器中都会发生。在CFNetwork上专门运行的字符串显示:

I'm experiencing the same issue, the message is being issued from the CFNetwork framework, this happens both on device and in the iOS simulator. Specifically running strings on CFNetwork shows:

ADDRESPONSE - 不添加磁盘或内存:%@
ADDRESPONSE - 仅添加到内存:%@

ADDRESPONSE - not adding TO DISK OR MEMORY: %@ ADDRESPONSE - ADDING TO MEMORY ONLY: %@

我的猜测是它是由CFCachedURLResponse方法发布的。

My guess is it is being issued by CFCachedURLResponse method.

更新 - 进一步调查我的问题是由以下原因造成的:

An update - with further investigation my problem is caused by the following:

NSURLCache *cache = [[NSURLCache alloc] initWithMemoryCapacity: memoryCapacity diskCapacity: discCapacity diskPath:[SDURLCache defaultCachePath]];
[NSURCache setSharedCache:cache];

其中memoryCapacity == 0.将此设置为某个实际值(如10MB)会停止发出消息,似乎正如我所期望的那样从缓存中检索对象。

Where memoryCapacity == 0. Setting this to some realistic value like 10MB stopped the messages from being issued and appeared to retrieve objects from the cache as I would expect.

不幸或者取决于你的观点NSURLRequest等行为随iOS 5而改变。现在NSURLRequestCachePolicy已被采取行动,这意味着你将需要检查您的应用运行的iOS版本,并相应地调整您的缓存行为。

Unfortunately or otherwise depending on your perspective NSURLRequest etc behaviour changed with iOS 5. NSURLRequestCachePolicy is now acted upon, meaning you will need to check which iOS version your app is running on and adjust your caching behaviour accordingly.

这篇关于我在iOS 6.0的Xcode 4.5中没有要求的日志消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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