Solution to problem encountered using Xcode 6


#1

I’m not sure if this problem is specific to Xcode 6, but I didn’t see this issue addressed in any of the other topics for this chapter so I’m assuming it is.

After disabling Auto Layout, My view was being drawn with the green color as it was supposed to, however the bezier path would not draw. After exploring what might be causing this, I figured out the initWithFrame: method was never actually being called.

The solution I found to this was

  1. Select MainMenu.xib
  2. Select the File Inspector
  3. Under “Runtime Behavior” -> “Instantiation”, uncheck Prefer coder

I’m not entirely sure why this fixed the problem, but if you’re having the same issue give it a try. If anyone does know why this fixes the problem and would like to share that would be great :slight_smile:


#2

Thank you, copernicus!

I had also done enough troubleshooting to determine that my initWithFrame: method was not getting called, but I had no idea why. I don’t know if I would have ever found the solution, but it makes sense now that you point it out. The “prefer coder” phrase for instantiation confused me at first, but I am assuming that they are referring to the unarchiving of the objects via the NSCoder for the NIB. I am guessing that this checkbox is essentially saying: “Prefer to initialize everything straight from the NIB file and don’t send any actual initializers to any contained classes.” I don’t know why this would be the default. I think the default should be unchecked (and to send the initializers).