iPhone 3G + iOS4 debug problems - iphone

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.

Related

App crashes on iPhone but not on simulator

I'm using XCode 7.0b5 and created an Swift app. It runs fine on simulator but crashes on iPhone 4s when running independently (without cable).
How can identify where it crashes? I read about possible memory issues. I'm reading in a large textfile, so it needs nearly 200 MB of ram. How can I check it?
I think this is a memory problem with the iPhone 4S (200 mb for 4S is a lot). You should read the crash logs in Xcode.
In Xcode with the iPhone connected you can go to Window->Devices, select your phone and press 'View Device Logs'. You will see a list with all the last crashes of the apps and with the information of the crash.
Regards
I got the solution. It is the run time.
I reduced the file sizes to 10% of the original and everything runs fine. So I can test it and "improve" it to the speed limit of the iPhone 4S. :-)

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.

App crashes on device and while using instruments only

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.

IPhone - Application behaving differently after some time in background

I would like you to help me here.
I'm developing an app that works in the background. It's a location-based app and I think I'm going crazy because when I'm debugging the app in the device it works perfectly, I make it sleep I wake it up and I works as expected. Then I unplug the device from the computer and I put in my pocket and whenever I open it, it sometimes works and other it doesn't, I'm talking about several hours in the background.
Are there any known issues about this? My device is running iOS 5.0 and I'm developing for iOS 4.0
Thanks
Applications in the background are handled by iOS. Therefore if iOS "thinks" that it needs memory it maybe frees some of the memory your app needs to run.
Have you tried to look into it with Instruments?

If an app works on one iPhone, should it work on all phones?

I'm testing my app on an iPhone 4 and iPhone 3GS. It works perfectly on the simulator and the iphone 4 but crashes after several mins of use on the jailbroken 3gs.
On the iphone 3gs, the only apps i've installed are TetherMe and SBSettings.
Can i just assume that the app crashes due to the phone being jailbroken?
No. You cannot assume that an app tested on one device will run on all others.
Your app will have very different amounts of memory available on different devices (and under different OS versions, and with different amounts of background processes running).
The application developed for one version of iOS might not work in another. This is true not only for iOS and iPhone, but for any other application and operating system and/or its version. The difference might me in memory consumption, different API behavior, ABI incompatibility or something else. However, you cannot just assume it is due to jailbreaking. To get the answer as for the crash, you have to run application under the debugger, if possible. Otherwise try to debug it using print statements, for example.
Hope it helps.