1

I know it's sounds silly but just to clear a point. Is there any chance that view did load will be called before didBecomeActive ? Is it totally impossible ?

EDIT

We have a crash that happens when user is coming back to the app from the background and we start to use openGL. The crash error points that we try to use openGL in the background.

It is important to say that our app lives in the background as a VOIP app.

We try to figure out if there is a chance that somehow we are triggering something in the background thats causes the app restart openGl in the background.

In the stack we see:

[VideoCallViewController viewDidLoad] (VideoCallViewController.m:283)

And few lines after that:

[GPUImageContext createContext]

And finally:

gpus_ReturnNotPermittedKillClient + 10

We are trying to figure out if there is a way that [VideoCallViewController viewDidLoad] was called in the background or that we must assume that we are in the foreground, and somehow moving to the background right after the viewDidLoad ?

Second option The second option is that we are indeed moving to the background right after the viewDidLoad. The point here is that we are listening to AppWillResignActive and we pause the GPUIMage. So we can not understand why do we get the crash ?

Thanks

Thanks

shannoga
  • 19,000
  • 20
  • 99
  • 163

1 Answers1

0

When / Where do you instantiate the various GPUImage objects that you are using? Is it within viewDidLoad or possibly within init:?

It's just pure rampant speculation here since you didn't really post any code...

but if you are disposing of objects when the app heads to the background that are not then re-created when it comes back to the foreground (perhaps because the viewController was retained by a parent, and therefore init: was not called again but viewDidLoad was...) Then you may be trying to send OpenGL messages to objects that don't actually exist anymore.

On the (probably unlikely) chance that my speculation is right, you could easily fix it with the common "getter" pattern of:

- (GPUImageObjectOfInterest*)instanceOfObject {
    if (!_classVariableOfThisType) {
        _classVariableOfThisType = [[GPUImageObjectOfInterest alloc] init];
        // custom configuration, etc...
       }

    return _classVariableOfThisType;
}

and then use [self instanceOfObject]; wherever you used to use _classVariableOfThisType

It's a low overhead, but reasonably foolproof way of making sure a key object exists under a wide range of app interruption / background & foreground & low memory conditions.

Don't be shy to post too much code though, we can read through an entire class if needed. Some of us like reading code! (and it will really help the quality of response you get...)

ryan cumley
  • 1,871
  • 12
  • 11