Project compiles in XCode, but won't save changes when exiting and returning to UE4 editor

I am trying to create a C++ class that will give me access to functions and variables via blueprints. However I don’t seem to be able to make my changes to the editor persistent. My steps are as follows (I am running a Mac with El Capitan and v 4.9.2 of the editor):

  1. In UE4 Editor, add a new C++ Class
  2. Open the XCode project that is automatically generated
  3. Fill in my C++ code in .h and .cpp files
  4. Compile using the profile for (MyProjectName)Editor - mac
  5. Compile succeeded
  6. Return to UE4 editor and I can see the variables I created in my C++ file when I create a new blueprint based on that class.

However, the problem is that when I save my project, then quit and reopen it, none of the variables or functions I created are valid and I get errors (in the UE4 editor). Is there a step I’m missing here to make the changes permanent/persistent?

Okay. Found the fix. Go to the menu and choose “Product > Build for > profiling” and…voila! It will compile your code and ensure that all of your changes are persistent for the next time that you open your project in the editor.