iPhone OpenGL ES app killed on iPad when using "2x" button - iphone

Hey, I got kind of a weird issue here.
I have an iPhone-only OpenGL ES app which runs fine on all iPhone and iPod touch models supported.
When running on the iPad, it runs on an iPhone-sized window as expected, and pressing the "2x" button once scales up the window to twice the size, as expected, and the app continues to run without problems.
But if the user taps the "2x" button 3 or 4 times quickly, the app is killed with the Program received signal: "0" message (which, from what I understand, means the OS killed my app for using too much memory, is that right?)
What I really do not understand is what in my app could possibly be using up more memory when the iPad scales the window up and down? As far as I know there's not even any way for my app to tell if and when the iPad is doing that. I don't know if the fact I'm using OpenGL ES is related or not, but that issue doesn't happen on any of the Cocoa Touch apps I have - though it also doesn't happen on the other two OpenGL ES apps I have. And this app does use more memory than any of the other ones.
Anyone ever had or even heard of this problem? Googling gave me nothing.

Since no one has posted with a direct answer (your situation might be a little vague), I have a suggestion for how to move forward and gather more information on what might be causing your problem.
Check out the Instruments in Xcode which can identify memory leaks:
Instruments User Guide
Or for an even friendlier introduction, here's a video that address performance issues, including memory leaks (and how to find them). iOS Performance Optimization Video

Just adding this so there's some kind of an answer here...
I never figured out what the hell was going on with the 2x button.
The way I fixed it back then was to optimize memory usage as much as I could, lazy-load all that I could and unload again when not in use.
Weird that it never complains about memory when running on any of the supported iPhone or iPod touch models, even the older ones, but it got killed on the iPad ONLY when pressing the 2x button repeatedly and quickly... I guess that's always gonna be a mystery to me.

Related

glDrawElements incorrectly renders points on iPhone

I am fairly new to OpenGL development on iOS. I'm working on software that will create 3D reconstructions of objects in the form of *.ply files. I'm trying to make an iOS app to visualize these simple vertex-only *.ply files. Everything works as intended on the iPhone and iPad Simulator, but when I run it on my iPhone, the points rendered in the view are glitchy and covered with large squares. Here's the comparison: iPhone and simulator. Has anyone run into similar issues with OpenGL?
It's important to understand that when running OpenGL ES code on the simulator, you're actually running it on the simulator's software implementation and not on the GPU.
The simulator's implementation is close to, but not identical to the implementation on the device GPU. This means that faulty code may render fine on the simulator. I've experienced it myself on a couple of occasions, like when using glbuffers and not allocating enough storage.
It's obviously hard to say where your code goes wrong, but I'd suggest you to go through your code and look for subtle errors.

App works on iphone simulator,iphone device, ipad simulator but not ipad device

So I made an app, And it runs on all possible platforms except the ipad device. I would understand if it ran on the ipad device and not the iphone device since the processor is better on the ipad, but this has me stumped. It also worked fine on the ipad simulator. Can anyone think of a reason why this could be?
There are too few details to give an explanation. A possibility is: when you run the app in two different devices, iPhone and iPad, some nib files could be different. Even the app delegate is different if you use XCode templates for universal apps. So this means that it is possible that the code executed is different in the two devices.
So imagine that in the iPad app delegate / view controller you're allocating - at launch - a lot of memory (scroll view with many large images for example). Then the app will not crash in the simulator (it uses your Mac memory). The app will not crash in the iPhone (different code). So at the end it will crash in the iPad only.
Other possibilities: you're going short in memory very soon. But the iPad 1 has less memory than iPhone 4G.
Other possibility: the watchdog timer kills your app at launch. It happens on the iPad 1 only because you're loading a few large images and it takes a lot of time, just enough to be killed by the watchdog.
Other possibility: iPad 1 is still with iOS 3.2, while iPhone and simulator are linked to iOS 4.0. In this case it is easy to have the app crashing in iPad 1 by calling one of the many new APIs introduced with iOS 4.
As you can see there are many possible explanations...
add target for device or convert it to universal application
Yes, it's easy to target both platforms. If you login to ADC and read the Programming Guide, it'll provide the basics for specific development. I can't legally speak of the "how."
Um. If you follow their directions, build two targets, share your source within the same project... then you'll be set. It's the same SDK, just different Nibs & main(), from what I can tell.
You say different xibs... you might be missing an Outlet connection somewhere.
Ok gents, sorry but I did not provide enough information for any of you to correctly answer this, but! here was my problem.
I had a login screen with 2 textfields, and a submit button. The submit button would release the current view and add a new view. I would usually press submit while the keyboard is being shown. Aparantly this makes everything blow up. You must manually hide the keyboard first. Hopefully this saves somebody some time.

Mysterious glitch in iPhone app

My app/game has gone live in the App Store two days ago. Now I'm getting reports of a mysterious glitch that occurs when several levels have been completed (it's a puzzle game). The screen just gets black, no user interaction is possible anymore at all.
I think what happens is that my view gets deallocated, so the only thing that's left is my window, which has a black background.
At first I thought this could be due to a memory warning to which my view controller responds by releasing the view. But when I simulate memory warnings on the Simulator, everythings goes fine.
I have tested my app extensively using Instruments. It contains no memory leaks. It is using a constant ~43MB during gameplay. CPU load is low.
I'm quite clueless here. It's frustrating that I cannot reproduce the problem myself. I can't count the levels I've played myself anymore, trying to get this glitch to occur. Anyone have some suggestions?
But when I simulate memory warnings on the Simulator, everythings goes fine.
Did you try to simulate it on a real device with instruments? Did you try with older device models like 3g, 3gs?

App is fast on 3GS but slow on 3G

I'm new to computer coding and have just finished coding an app and tested it on both 3G and 3GS. On 3GS, it worked as normal as on the simulator. However, when I tried to run it on 3G, the app becomes extremely slow. I'm not sure what's the reason and I hope someone could shed some light on me.
Generally, my app has a couple of view controller classes, with one of them being the title page, one being the main page, one is setting, etc. I used a dissolve to transition from the title page to the main page. But even this simple transition shows un-smooth performance on a 3G! My other part of the app involves zooming in to some images by scaling up the images, switching images by push or dissolve upon receiving touch events, saving photos into photo library and storing and retrieving some photos in a folder and some data in a SQlite database, each showing un-smooth actions.
Compared with some heavy graphic or heavy maths app, I think mine is pretty simple. I totally have no clue why the app would behave so slow and un-smooth that it is barely useful on a 3G. Any help/ direction would be much appreciated. Thanks for helping out.
You might want to try profiling your application with Shark to find out where the performance bottlenecks are.
I don't know how relevant it is to your case, but my game (shameless plug) MultiMaze is quite undemanding graphically, and worked beautifully on my 3GS. But when I tried it on a 3G, the frame rate dropped to a glacial 10-20 fps. I ported the whole code base from CoreGraphics to OpenGL ES, and that made a world of difference. It now runs at the limit (60 fps) on my 3GS and very close to it on the 3G.
Are you using a lot of memory? 3G has 128MB while the 3GS has 256MB RAM.
Are you getting memory warnings? In my debug builds I have an NSLog in didReceiveMemoryWarning so I can see if/when I get warnings.
EDIT: Check the size of your photos, are they resized for the iPhone screen or are they original sized?
OK, finally found the problem and got the solution. The problem was that I have about a dozens of transparent images laying on each other to form my main view. So when in any animation, the system needs to redraw on every single layer and calculate their transparent effect and so on. (actually I'm not quite sure, but that's what I think)
The solution I have is to make a temporary composite view containing of them all, and placing the composite as an image in a full screen view before starting any animation. It delays starting the fade a moment, but the fade itself is a lot smoother now.

IPhone application won't launch correctly

So I'm developing and iPhone game right now and everything has been working just fine when I test it on my first gen iPod touch. Last night, I added in some NSUserDefaults stuff to save a few variables for it. I ran it on the simulator a few times and it worked perfectly, but when I built the app and put it on my iPod, all I got when I launched it was a black screen. Anyone have any ideas? They would be much appreciated, thank you.
I recommend deleting the application from your iPod Touch first then trying to install it again. When are you trying to read from NSUserDefaults? In your applicationWillFinishLaunching call? If so, try to comment that out to ensure that it really is the source of your problem.
You need to run it on the iPod touch with the debugger switched on - you should be able to track this down.
Do you know about setting a breakpoint for exceptions - if you tell the debugger to break on objc_exception_throw it is extreemly useful in these cases.
Do you have a custom Default.png file? If no, then you will see a black screen while your application loads. Depending what type of (possibly unending) operations you are doing on load this might be the reason you are seeing a black screen. Remember the simulator runs on top of the processor in your mac which is significantly faster than the processor in your iPod Touch.