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

Objective CXcodeIos6

Objective C Problem Overview


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 ?

Objective C Solutions


Solution 1 - Objective C

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.

Solution 2 - Objective C

I have same issue as like you. I don't know but I did fixed it by using following formation in viewDidLoad method.

-(void) viewDidLoad
{
  // First write my code of UI Creation.
  // Then I call 
  
  [super viewDidLoad]; //add [super viewDidLoad] AFTER implementation, not before.
}

This is working well for me, hope this is also work for you.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJörg KirchhofView Question on Stackoverflow
Solution 1 - Objective CShane MacPhillamyView Answer on Stackoverflow
Solution 2 - Objective CiPatelView Answer on Stackoverflow