Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode memory warning - could not load any Objective-C class information

I've been getting this error only on an old iPhone4s while logging the user with Facebook and Parse. When I run it on simulator this error never happen.

When it happens the app has taken only 21.2MB from memory that is just 4.2% of the memory available on my testing 4s.

I am not so sure from where to start in order to fix this bug. Completely lost to be honest.

2015-11-12 08:09:27.647 APPNAME[3883:426582] Received memory warning. warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available. (lldb)

Some updates on the question, if you still think it is a duplicate I will remove it. Although the question you suggested as a replica do not actually help me to solve the issue.

I could partially remove the error by reducing the number of queries that where happening at the same time and using Parse. The app in order to get a first launch and sign up a new user I would need to:

  • log with facebook
  • query facebook graph data
  • add facebook graph data to Parse user
  • create reputation table and relate
  • launch main screen
  • query reputation
  • query terms and conditions
  • query tutorial status

By removing the last two ones I could get the warning to go away in the first seconds of app use. And then I get the warning/error after 10 minutes of letting the app run with no interaction.

That makes me think, if you have many queries happening on background at the same time can that cause this type of memory warning? Or this is purely a bug on Xcode as the other question suggests?

like image 355
GuiSoySauce Avatar asked Nov 11 '15 19:11

GuiSoySauce


1 Answers

I encountered this warning while building my Cocoa(OS X) app. but apperantly it would happen to iOS app as well.

warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available

With this warning, Xcode 7.3.1 took me to a code line inside the 3rd party library -SwifyJSON. But I had known this was not related to the 3rd party library at all because it had been working very well until the warnig had occured.

I had MainViewController with TabViewController which had a couple of custom views(and Controllers, of course)

I encountered the warning right after setting my second custom class' instaces in order to pass data between them.

In MainVC, my code was

private var firstTabVC = FirstTabVC
var jsonInfo:JsonInfoClass  = JsonInfoClass
private var secondTabVC = SecondTabVC // waring had occured after this was added

Xcode took me to the 3rd party library only when the 'jsonInfo' instance line was right above the 'secondTabVC' instance line. (the JsonInfoClass is the custom class dealing with JSON data with the 3rd party library)

I moved the problematic code line just below the 'firstTabVC' line. and then the Xcode stopped to complain 'loading Objective-C class' thing. I only got the "EXC_BAD_ACCESS" error on the 'firstTabVC' line. This was where I had started not to believe what Xcode said.

So, I went to SecondTabVC custom class and I saw that I declared the instance of MainVC.swft (I had no idea why I did like this anyway) like:

var mainVC:MainViewController = MainViewController()

to set 'self'(MainVC) in it so that I can pass data from MainVC like:

override func prepareForSegue(segue: NSStoryboardSegue, sender: AnyObject?) {
    .
    ..
    secondTabVC.mainVC = self
    ....
}

after I changed the declaration in SecondTabVC.swif to

 var mainVC: MainViewController!

The waring was gone and worked fine. I hope this helps someone.

like image 152
Kyle KIM Avatar answered Nov 11 '22 21:11

Kyle KIM