Unity iOS OpenGL app crash - ios

I have an iOS Unity Game developed. In order to help tester to track the bug, I have added one more module which will take the snapshot and then show a view to the tester to Annotate it. I am using Apple's GLPaint example : https://developer.apple.com/library/ios/samplecode/GLPaint/Introduction/Intro.html .
When I start annotating, I pause the Unity game and resume when the annotation is over. But there is one problem, when I try to resume the unity game, the app crashes weirdly with some error GL_INVALID_OPERATION
Check the trace log

Never used Unity, but it smells like the current GL context changes when you bring up the annotation view, and isn't restored properly when you return to the game. Give saving/restoring Unity's GL context a shot (see: EAGLContext +currentContext & +setCurrentContext:).

Related

Passing Data From native iOS app to Unity App

I have iOS app now i want to add some animation in my app so i think to create Unity app for that animation. So now i want open unity app from my iOS app with button click action are you getting ?
Now animation is generate the dynamic number ball so for that i have to pass the parameter(Number of total ball, Number of ball to ball generate, Ball colour code) to unity app from iOS app.
So is there any possible way to pass the data from iOS app to Unity. I i'm thinking to use URL Scheme Or any other method available?
I am assuming you want to communicate between two apps. For that there are several ways.
To open other app within an app, please check this answer here.
Solution 1:
Don't use two apps to do single animation. Thats not good practice and not feasible. Do animation inside your iOS app and I believe iOS is powerful enough to handle your animation. Apple has already suite of game technologies to support gaming development in iOS natively. You can check this link here.
Solution 3:
If you can build app in unity, build whole app in unity.
Solution 2:
The first part of your question is very confusing though. You want to show animation in your iOS app but want to create animation in unity app? That is not going to work. Because when you open unity app, the current app will be suspended as default and you will only see unity app at that time.
As per your 2nd part of the question you want pass some arguments from iOS for animation to play in unity app. To do that you have to save data locally (in some kind of database whatever you like), like Number of total ball, Number of ball to ball generate, Ball colour code. And then you have to do code for unity to read those parameters from database and do the animation accordingly.

UIWebView HTML 5 game Canvas drawing slowness in iOS 9, or WebGL crashing in iOS 8.0 and above

I've having an issue with UIWebView and running HTML 5 games (that another developer is working on). We've tried two different options, and neither is optimal.
Option 1: He renders the HTML 5 game with "canvas drawing". When he does it this way, nothing crashes, however in iOS 9 when we go back into the app from the background, the Web View loads back up, but the game is moving much slower than normal (issue not on iOS 7.1 and above). By much slower I'm talking about the animations are not moving the same velocity that they were when we first load the game. The weird thing about this issue is that even if the user opens up a different HTML 5 game (we're adding multiple games) the animations are slower for that game as well. I've tried dismissing the Web View Controller when the UIApplicationWillResignActiveNotification gets posted. When I set the game up this way, the slowness only happens if the app is in the for 4 seconds (it's very strange).
Option 2: He renders the game with "WebGL". When he renders it this way, the app crashes when the app gets backgrounded on iOS 8.0 and above. My research into the crash is that iOS can't draw OpenGL ES in the background. I'm assuming that the WebGL commands are running similar commands as OpenGL ES would do, hence the crash. Dismissing the Web View Controller on UIApplicationWillResignActiveNotification still causes the crash to happen.
Has anyone else ever dealt with a situation like this?
I've not found a good solution to the problem, but I did find a work around.
When I get the App Will Resign Active message, I remove the UIWebView from the UIWebViewController's subview. When I get the Did Become Active message, I add the UIWebView to the UIWebViewController's subview.
This solution works for both cases.

Problems going back and forth between scenes (Sprite Kit)

I am new to the iOS platform and have written an app using Sprite Kit and Xamarin. To transition between scenes I am using NavigationController.PushViewController with a "Back" button on the new scene to return. This works fine.
My problem occurs when I go back and forth between the original scene and next scene about 3 times. The frame rate (and overall application) slows to a crawl, and depending on which scenes, will hard crash. This happens only on device and not in the simulator. My gut instinct says I'm leaking memory somewhere / not cleaning up properly, so I have just started getting up-to-speed with Instruments. Note that each scene has about 5-8 images on it.
Questions:
What is the proper way to clean-up after transitioning out of a scene back to the previous one? I am explicitly calling RemoveAllActions() and RemoveAllChildren() to ensure clean-up.
What is my best strategy when using Instruments? I've only just begun to experiment with an Allocations trace, but there are a lot of allocations and knowing what to look for is challenging.
Any help is appreciated. I am considering dumping Sprite Kit altogether since my app doesn't really need it (I wanted to experiment) and because it has been a challenge building the app with all kinds of deep crashes (e.g. SKShapeNode, which is very problematic).
Thanks.

iOS App Crash with [GPUImageContext presentBufferForDisplay]

I'm using a GPUImage library for developing an iOS camera app.
I found sometimes app crash with GPUImageContext.
I noticed it via Crashlytics Crash report,
and App crash at GPUImageContext.m line 196, below method.
- (void)presentBufferForDisplay;
{
[self.context presentRenderbuffer:GL_RENDERBUFFER];
}
I confirmed below question, but I support below case.
Mysterious app crash with OpenGL
Does anyone suggest the reason of this crash?
I receive crash report, most crash(90%) occur in iPod.
You can't access OpenGL ES at all when your application is running in the background (suspended). GPUImage uses OpenGL ES for everything it does. You have to make sure that all work your application is doing with GPUImage (filtering video, processing an image) is done before your application completes its transition to the background.
You need to listen for the UIApplicationWillResignActiveNotification or fill out the related delegate callbacks for the transition to the background, and in there pause any camera capture (via the -pauseCameraCapture method on your camera input) or wait for any processing to finish (I believe a synchronous dispatch into the GPUImage serial dispatch queue will take care of this).
Related discussion for this can be found on the GitHub issues page here: https://github.com/BradLarson/GPUImage/issues/197 and in several related issues.

How do I shut down OpenGL tasks in applicationWillResignActive?

I have nearly completed my first app. In testing on the device, I am getting a crash when I press the home button, with the error message
libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient:
Based on these posts:
https://stackoverflow.com/search?q=how+to+shut+down+OpenGL
OpenGL ES crash on move background, iOS 5.1
I am pretty sure the problem is that my app is an extension of software that uses some sample code involving OpenGL (about which I have very little understanding) and that the OpenGL tasks are not shutting down properly on resignActive.
I tried the following in my AppDelegate with no luck:
- (void)applicationWillResignActive:(UIApplication *)application {
glFinish();
}
My app does not need to save any settings upon exit... it just needs to end.
Can anyone suggest a solution?
I am now working on a Sprite Kit game and I had a similar problem.
Check if you have on the screen the node that tells the FPS, because that might be rendering and causing the crash.. It did for me.
In applicationWillResignActive method I call my pause method as all of you.
*edit - and check for audio playing
To finish program at user push home button ?
on Xcode, choice Target and select Info tab.
Custom iOS Target Properties, add a Key named
Application does not run in background
and set Value
YES
Try it!
p.s. Not necessary write glFinish().

Resources