Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
351 views
in Technique[技术] by (71.8m points)

objective c - Log Messages I didn't asked for in Xcode 4.5 with iOS 6.0

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 ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 - not adding TO DISK OR MEMORY: %@ ADDRESPONSE - ADDING TO MEMORY ONLY: %@

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];

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...