how to solve problem exit status with 10 in device? - iphone

I have implemented pdf reader application for ipad.Its working fine in simulator.But its terminated in device with exit status 10.I done know whats happning.Please help me solve this problem.
Thanks in advance.

John,
Most likely it is a memory leak that is causing the app to get killed for consuming too much memory. Run the app with the Leaks tool (in the Run menu of XCode) and check how much memory gets allocated on load or during use.
Try it on the simulator first since you said it won't work on the device. Also, be sure you are releasing all objects you create after using them (but only the ones you create, not the ones Apple does).
A good reference guide to memory management: http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.pdf

Related

Concerns about testing an app on actual iphone

I would like to start testing my application on my iPhone. However, I have one concern.
What if my app has many memory leaks? If i ran such an app on the iPhone multiple times, wouldn't that result in a crash on my iPhone? i.e memory keeps getting allocated but never deallocated?
should i worry about accidentally creating unnecessary files on my iphone such that each time I run i somehow create a file that i dont delete, and it keeps taking up a few kb of space. I test the app many times and after a while i have no space left on my iphone. can such a thing happen? can testing on an actual device damage my phone???
Thanks!
What if my app has many memory leaks? If i ran such an app on the
iPhone multiple times, wouldn't that result in a crash on my iPhone?
i.e memory keeps getting allocated but never deallocated?
Memory leaks are only a problem as long as the memory is still allocated for your application. As soon as your application closes, or crashes, its memory is deallocated and returned to the OS. If you are running iOS 4 you can double click the home button and close the application to free up memory.
should i worry about accidentally creating unnecessary files on my
iphone such that each time I run i somehow create a file that i dont
delete, and it keeps taking up a few kb of space. I test the app many
times and after a while i have no space left on my iphone. can such a
thing happen?
Yea you should take care to create as few files as possible. However, because all files created by your app are contained in a little sandbox that is associated with your app they are deleted when your app is uninstalled. If you feel like your test app is taking up too much space simply uninstall it and then install it again using Xcode. Although I wouldn't worry too much about this as you would have to create A LOT of large test files before they started filling up your phone.
can testing on an actual device damage my phone???
I highly doubt its possible. That is one of the reasons that apple restricts which API's you can and can't use. If you jailbreak your phone and start doing things apple doesn't want you to do all bets are off.
I wouldn't worry too much about messing up your phone by developing on it. I've never heard of someone damaging their phone doing this and if for some reason you phone starts acting up just restore it in iTunes.
Here's a tip. Use Analyze tool in Xcode. Find leaks and remove them. And check the performance using Instruments. Fix your memory leaks using that as well. Once you do both diligently, there should be no reason to worry about leaks anymore. Your other concerns are a bit unnecessary. If you are using only the public cocoa touch APIs, your device should be perfectly safe :)
Also be sure to clean up any unused resources, etc. When you send it to the background, it only does so much. Make sure you release objects you own, and release the resources. Set autorelease when you can.

Xcode 4 question about object library and NSLog

Two questions. All of a sudden, not sure why, maybe I hit the incorrect hot key, but my Object Library for .xibs in IB now shows NS items used in Mac development and not my typical iOS elements. How do I bring that back?
Second question, if I run an app in the simulator and it says in the console:
Received memory warning.Level = 1
What should I start with in troubleshooting? This is on an old 3G iPhone. Thanks!
regarding your second question: you should start troubleshooting your app for an excess of memory allocation and, if you can, look for memory leaks
maybe you want to look at this topic: iPhone OS Memory Warnings. What Do The Different Levels Mean?
For the first question: restart XCode.
For the second question: If the warning is infrequent and your app is not crashing, don't worry about it. Regardless or warnings or not you should be doing memory testing for leaks and also make sure your app responds to didReceiveMemoryWarning notifications. These warnings are normal and vary greatly depending on what other processes are running.

iPhone camera application running fine in iPhone but crashing in iPod

i made an iPhone app that uses camera. It works fine in iPhone, no memory warnings at all. It is also running on iPod touch 4G but gives memory warnings and crashes after some time after getting level 2 warning.
If someone can point me the possible reason for this. Thanks.
The only way you are going to fix this is by being able to debug it on the device. I wrote this blog to explain how to debug EXC_BAD_ACCESS, which is what I assume you are getting
http://loufranco.com/blog/files/Understanding-EXC_BAD_ACCESS.html
The simplest things to do:
Run a Build and Analyze and fix every problem it finds (or at least rewrite it so that B&A doesn't think it's a problem) -- Having a clean B&A is a really good way to making sure you catch these problems early
Turn on Zombies and run your program -- this makes the last release sent to an object turn it into a zombie rather than dealloc it. Your program will leak tons of memory, but if you ever send a message to a zombie it will stop right there and you will see a bug that you need to fix, because in your real version, that would be a crash (sending a message to a dealloced object).
More techniques described at the link
It crashes on a specific operation or randomly?
if randomly,
use instrument to check your memory leaks and memory usage. It's hard to figure out where the problem lies in without going through all your app.

Small application gets "didReceiveMemoryWarning" right after start

Often, when a lot of applications were opened before my application I get "didReceiveMemoryWarning" and then, after a while iOS usually closes my application.
This is actually become a noticeable problem.
I have read so much so much consider to "didReceiveMemoryWarning" for the last few days. Including posts here. Unfortunately no solution found.
I know that I have to release any memory on this warning and bla-bla-bla…
The problem is that right after application start there is nothing to release. I have one UIViewControlled in memory with AdMob 4.0.2 banner and one own container that serves application data - which is a few records in NSMuttableArray.
Right after start my application takes 1.3 Mb – according to Instruments and at this initial state my application was not working and I definately know no memory leaks.
What is wrong?
I see that some of the heavy games can be started with no problems, but in the same time my application in this case gets "didReceiveMemoryWarning" and is closed.
Is there a way work in normal way in this situation.
Is there some tricks?
Thanks in advance for your suggestions.
Where are you allocating the NSMUtableArray? I think it's being allocated often! (Just a probability...) Do you releasing the NSMutableArray?

Game crashes on the actual iPhone but simulator? memory problem?

I have built my first game using Cocos2D. It worked fine on the simulator. But when it runs on the actual iPhone, it crashes. I don know why. Thought it was memory leaks, so i tried to detect, but no leaks found. I tried to increase and decrease frame rate, neither both succeeded. Anyone experienced please help me out. I am really stressed now. If anyone had the same issue please share with me your opinion.
Yours thanksfully.
I've run into similar issues (I also use Cocos, but I don't think this is Cocos specific). The best thing to do is plug-in your iPhone and watch the stacktrace when it crashes (or retrieve the stacktrace after the fact)
This happened to me a lot because the resources between the iPhone and the simulator were not in sync; in other words, some how resources would be available to the simulator (eg: images) but those same resources were not transferred to the iPhone for whatever reason. Sometimes, if I ran 'clean' on the simulator, I would observe the same issue.
It's extremely frustrating to debug these types of issues, but you'll get used to it.
I agree with Dominic - we definitely need more information to be able to help you - do you have the output from the console or the stack from the debugger?
Also, while memory leaks are a Bad Thing, they rarely lead to crashes directly. They will increase the amount of memory used by your app so if you're memory intensive then you might get a problem but they're not the first place I'd look to try to debug this.
Try running the app in Instruments and watch the memory usage graph - then not only can you see the total that your app is using but you can get an idea of which sections of your app use the most and can focus your efforts in reducing it.
Sam
Sorry, but you need to specify more details. How does it crash? What does the error log say? One thing you might look into is the amount of memory, your game consumes. If it uses more than 64 MB on the actual device, the OS will very likely just terminate it. In the simulator on the other hand, your app might use lots more memory without a problem.
I have found tools like Instruments and NSZombieEnabled to be very helpful in tracking down issues such as these.
Without more information, I would try the following steps:
Delete the app from the device and simulator (using the tap-and-hold technique to make your icons jiggle) and reinstall it. Sometimes a setting (or lack of a setting) in the user defaults will cause a crash, and those don't get wiped out unless you delete and re-run your app.
Also try the "simulate memory warning" option in the simulator and see if that gets it to crash.