Description
So I have a game that works in landscape mode and want to add share dialog functionality via UIActivityViewController. Here is a code:
-(void)share
{
NSMutableArray* sharingItems = [NSMutableArray new];
[sharingItems addObject:@"Test message"];
UIActivityViewController* activityController = [[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil];
CCDirector* director = [CCDirector sharedDirector];
[director presentViewController:activityController animated:YES completion:nil];
}
Run my app, choose Share, select Messages to share info via text message. Messages dialog remains in landscape mode and when I close a dialog (to get back to my app) - everything works fine. If I rotate Messages to portrait mode and then close it - I start seeing these errors:
OpenGL error GL_INVALID_FRAMEBUFFER_OPERATION detected at -[CCRenderer flush] 653
OpenGL error GL_INVALID_OPERATION detected at -[CCGLView swapBuffers] 286
and screen becomes unresponsive (also I see GL_INVALID_FRAMEBUFFER_OPERATION / GL_INVALID_OPERATION every time when I touch a screen).
The only workaround I found so far is to create an additional UIViewControler to add its view to CCDirector's view:
-(void)share
{
...
CCDirector* director = [CCDirector sharedDirector];
UIViewController* tempVC = [[UIViewController alloc] init];
[[director view] addSubview:tempVC.view];
[tempVC presentViewController:activityController animated:YES completion:nil];
}
then it works fine (well, I still have to remove that tempVC.view at some point, that I can do with setting completionHandler for UIActivityViewController).
I might be wrong but this issue looks like a bug to me.