I will answer my question (since none of the above answers answered it), so someone with a similar problem may have a hint. I could not understand why this was happening, but I am sure that this is not a problem with my code, but rather a failure on the Apple side. And there is a workaround.
First, I compiled the Apple PDF Annotation Editor sample on my Lion 10.7.4, and although the functionality is clearly different from my project, it also found similar errors with the PDFView display that my project makes when compiled with 10.7. 4
Then I set about creating a fresh clean system on a new hard drive. Intalled Snow Leopard and updated to 10.6.8 and ONLY installed xcode. Compiled my project (the source code always remains exactly the same) and everything works fine. No problems were detected in the compiled project.
Updated my OSX to Lion 10.7.4 and xcode 4.3.3, same source code. The problem occurs after compiling it. I am sure that if I tried 10.7.3 first, I would not see this problem, because I remember that it starts only with 10.7.4, but Apple does not provide a reasonable way to upgrade to 10.7.3 first or down to it after 10.7.4 (shame on them, not very friendly for developers!).
So, the problem appears in 10.7.4.
Then I installed the preliminary version 10.7.5. It was the only thing that was changed, the same source, the same xcode. To my surprise, the compiled code works flawlessly, and the problems with 10.7.4 have now disappeared!
So, my decision is to wait until 10.7.5 is released before continuing with the project. I hope Apple does not introduce it into the future with Mountain Lion. I do not think that I will try to debug it further or send a ticket to Apple, and this will be a difficult case to explain.
Thanks for answers.
source share