I am using GLKViewController for iOS app. On some devices, there are problems (possibly with OpenGL), that I am unable to solve, because I dont see this problem on none of my devices or emulator.

Is there a way, how to "manually" force OpenGL (GLKViewController) to crash, but not to crash app? Or is there any other way, why GLKViewController instance can become null?

  • \$\begingroup\$ How do you know that there are problems in the first place? \$\endgroup\$ – dot_Sp0T Dec 30 '17 at 11:56
  • \$\begingroup\$ From user reporting some problems with disappearing OpenGL view entirely. \$\endgroup\$ – Martin Perry Dec 30 '17 at 12:00
  • \$\begingroup\$ Don't you get any crash-logs with the reports? \$\endgroup\$ – dot_Sp0T Dec 30 '17 at 12:11
  • \$\begingroup\$ No, because app is still running. Only view with OpenGL is gone. \$\endgroup\$ – Martin Perry Dec 30 '17 at 12:13
  • \$\begingroup\$ Can you narrow down whether this happens with specific devices or OS releases? \$\endgroup\$ – user1118321 Dec 30 '17 at 18:11

Sure, there are ways to cause GLKViewController to crash, ranging from giving it a bad delegate, to swizzling one of its methods and dereferencing a null pointer in the implementation, et cetera.

But doing so is pointless. It wouldn't help you fix a crash that users were seeing unless you happened to randomly choose to recreate precisely that crash, which would be very unlikely. And it certainly won't help you fix a problem that users are reporting that isn't even a crash.

What you probably want to do instead is ship a build with improved error checking and logging around the operations you're doing with the view controller and OpenGL setup. Log what is going on, make sure you're checking any NSError objects that are filled out, et cetera. Hopefully with such a build (which you may be able to distribute specifically to the users experiencing the problems), you will be able to generate a log that can help lead you down the right path.

| improve this answer | |
  • \$\begingroup\$ Or simply with a debug mode you can activate through console. You wouldn't have to distribute a special version that way \$\endgroup\$ – Bálint Mar 11 '18 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.