»
S
I
D
E
B
A
R
«
Error: “CGGStackRestore: gstack underflow”
Nov 2nd, 2009 by Anish Kumar

Today while I was working with some CoreGraphics API’s, I encountered a error which I was seeing it for the first time. CG for dumping an error “CGGStackRestore: gstack underflow” in the console everytime I invoked a method that was doing some CG based operations. Googling around I found that in CoreGraphics, you can save (CGContextSaveGState) and restore (CGContextRestoreGState) the graphics state. When theĀ  state is saved, a copy is put on the graphics state’s “stack”, and when it is restored, the top state on the stack is removed and used. If we restore the state more times than we save it and then when we try to remove and use the top item of the stack, the stack is empty, causing a stack “underflow” error. So just make sure you have enough save-restore state methods called and it will fix the issue.

CGGStackRestore

CGGStackRestore

How To Replace “__MyCompanyName__” in the new files from XCode
Oct 23rd, 2009 by Anish Kumar

When we create a new file in XCode, the default template has the company name listed as __MyCompanyName__. If you want this to show your actual company name instead of __MyCompanyName__, then execute the following command in your terminal. Make sure to replace the”YourCompanyNameHere” with the name of your company.

defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ "ORGANIZATIONNAME" = "YourCompanyNameHere" ; }'