App crashes on device and while using instruments only - iphone

I am encountering a strange behaviour, my app runs smoothly on simulator but crashes on device.
Also when i try to detect leaks using instruments it just crashes on both simulator and device.
I am totally stuck as i am not even able to generate any error message on console, also NSZombieEnabled is on in the settings.

I can see two possible reasons for the behavior you describe:
device is short on memory; (but you would see some processing in this case)
your app uses a newer SDK than what you have installed on your device (like using the SDK 5 twitter framework and then running your app on an SDK 4 device).
Specifically, in case 2, you would not see any log messages because the app would fail as soon as it tries to load the missing framework in memory.
In any case, inspect the device log in Xcode Organizer window to have more info about the crash. This is the only way you can understand what is happening.

Related

Xcode loses connection to device while debugging

My app has recently started exhibiting a strange behaviour. When I build and run from Xcode, the app launches until it hits the transition from the animated launch screen to the main screen of my app. At that point Xcode says "finished running yourApp on theDevice" and the app itself sometimes continues running on the device, or sometimes freezes.
Once this has happened, Xcode behaves as though my device is disconnected until I physically unplug and replug the USB cable.
Anyone run into this before and found a solution?
Potentially related, I have recently begun to see the "The device does not recognize this host" error periodically (mentioned here and here), although my app does not use Entitlements.
I had a similar issue and from this link started checking my project for images,textures etc larger than 1024 x 1024 and found one png which was around 2732 x 2048. After reducing its size I am not getting this bug.
I'd suggest trying with another cable plugged in another port.

iphone reboots after switching language

I'm developing iphone application with localization in Russian and English languages.
For localization I use Localazible.strings file, and also have a copy of Russian and English set of images.
The problem is: when I switch language and application is running in background, and then I'm trying to run application, it crashes, iphone reboots, and starts rebooting over and over. Only switching off and then switching on helps. After doing it I can run application in any language.
When application crashes debugger says only "program received signal 0".
How can I get reasons of such device behavior? These problem occurs on iphone 3gs with iOS 4.1 (jailbreak), iPad with iOS 4.2.1, iPhone 4 iOS 4.3.3 and DON'T occurs on iPhone 4 iOS 4.2.1.
When you change the language while debugging an app through Xcode, the app is killed by the system (during the reboot) and the debugger interprets that as a sigkill, which is what it is telling you - "program received signal 0".
Because the debugger has seen your app killed, it needs to be stopped from within Xcode before you can run it again, other wise you get what looks like a crash on launch and other such errors like "broken pipe" or "unable to start debugger, maybe it is hung in another process".
You won't be able to test a normal "resume from background" when changing language because changing the language restarts springboard and therefore your app is killed.
If you maintain UI state manually (as used to be required before multitasking) then you can restore it on the next launch of your app and maintain an illusion of multitasking.

app crashing on device

the app I've installed on an iPhone 3G device periodically crashes. I'm wondering if it's the device or the code. the code works fine on the simulator.
I have other apps from the app store that do the same thing. e.g. the stackoverflow app - whenever I do a search the app crashes. I've even had the iPod app crash too.
I've restored the phone a few times and still the same thing. I'm getting ready to upload the app to the app store and was wondering if anyone had any tips to make sure that my code is not the problem. it's difficult to tell because there are no errors in the simulator or memory leaks in Instruments
thanks in advance.
You can be guaranteed that it is your code. Run it in the debugger on the device and see where it is crashing. If you are getting EXC_BAD_ACCESS use the following to help track it down
http://www.cocoadev.com/index.pl?NSZombieEnabled
It most certainly is your code that crashes.
Run in debug mode and watch the console (real debug mode, not only the debug target).
Also, you can (and should) grab the crash report from the organizer. You can also watch the device's console there.
Are you sure you are not running out of memory?
the easiest way to see if this is your problem is to implement didReceiveMemoryWarning method of your controllers and check if they are called.
In the simulator you can simulate a memory warning but I am not sure if even in simulator app will crash if memory is not released. (I believe not)
Also run your app with instruments, using allocations: Run > Run with performance tools > Allocations.
And use your app for a while and you will see. ;)

iPhone 3G + iOS4 debug problems

I recently updated our test iPhone 3G with the latest version of iOS 4 to be able to test our apps on the new OS. I regret that I didn't read the forums because after the update the device's performance suffered a lot. However this is not a problem because the device still works. The problem is that when I try to debug our app the device freezes for minute and reboots or closes the app and returns to the home screen. When it manages to stop at breakpoint it takes few seconds to step over or out and often there's no debug information about the variables. I assume that this is due to some memory issues because the new OS requires more memory space. I must point out that our app worked fine with the iPhoneOS 3.1.3 and the Xcode 3.2.2 with the 3.2 SDK. It is a Universal app and that runs fine on the iPad too.
I have seen this problem as well when one of my applications was consuming a lot of memory. The background application that handles the remote debugging consumes quite a bit of ram (~15M the last time I had this problem). If your app is fine in standalone mode and crashing under debug then you might be close to the limit running in standalone (as I was).
I noticed that making sure that all other applications were quited or if I rebooted the iPhone that I was able to debug my executable (this was until I found the copied object problem that was causing the memory bloat).
If you have a jailbroken iPhone then you will have other services running consuming memory as well.
the iPad has double the ram 256M than the 3G at 128M.
I have also seen a problem when opening an application with a url encoded with data that runs > 500K that it will crash springboard before your debug session is started with a delayed launch.

Does anyone experiencing freezing during iPhone app launching or closing?

App freezes, and the device freezes sometime during launching or closing. This happens especially to the app developed and installed using Xcode. Can anyone explain what's going on, if it's iOS 4 Gold Beta specific issue, or a generic task must be handled by a developer?
Use the Debugger, Console and NSLog() statements to track the progress of your application throughout its life. This will help you track the bug in your application.