IPhone - Application behaving differently after some time in background - iphone

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?

Related

iOS platform: Running application on background

am new to the ios application development.
I had developed an application on iOS platform using 4.3 SDK.
When it runs on simulator or a device, if we are trying to press on the application icon again after quit the application at run time, the application is again starts its execution from the begining, not from the previous stage it has stopped.
By going throgh the documentation i came to know the multitasking facility is inbuilt for an iOS application.
Or we need to do any coding for implementing this multitasking facility.? Experts please help.
Thanks in advance.
Basically you should be able to go background and then foreground when using the simulator. remember that when running on simulator the GDB debugger is attached to the process thus you cannot terminate the app and start again but you can go background and start again. I think there is a good chance you are crashing and that's why the app starts again. Try to implement the app delegate methods "didResignActive" and "didBecomeActive" and make sure you manage the saving of the state correctly there...

Is it a bad sign that an ipad app runs perfectly on the ipad but not in the simulator?

i've been developing an ipad app for quite some time now, all the previous versions run perfectly on both the simulator and the Ipad, but the newest version which is a major revamp of the app, runs super smooth on the ipad but has a lot of issues on the simulator (images not appearing, etc)
Is this a bad sign? Should i wait to make it work on both before submitting?
Thanks!
I would suggest that you be sure to test it on both versions of iPad and as many OS versions as you can. Be sure that you are running the same OS on both simulator and iPad (As I see in the comments that you say you are). Just to rule out any problems with using code that is incompatable with older OS's.
In general though, if your app is running fine on the hardware you shouldn't have anything to worry about. I would be much more concerned if it was the other way around.
It is almost always bad when an app does something you did not expect or design it to do. If you designed the app to run on both the Simulator and the iPad, and it doesn't run on one, there is possibly something seriously wrong with your design that could do other unknown things during app review, or worse, on many app user's devices (leading to lots of 1-star ratings).
Therefore you should figure out why something is going wrong, and preferably fix it (or at least understand what's happening well enough to determine how it will behave on your customer's iPads).
Some other suggestions:
make sure that both device and simulator are using the same internet connection
uninstall your app from simulator and device, and run clean on your project, and then do a fresh install

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.

App freeze and then crashes on splash screen

I have an iPhone App published for a while, developed under the SDK3, and everything works great. Some weeks ago, when Apple released the SDK4 I made some changes to my app to support multitasking (it plays audio in the background).
In my simulator and my device (iPhone 3GS iOS4) the app runs great, there is no problem at all. But, now when I submit the update, a lot of users are contacting me because they say that the app freezes on the splash screen and after waiting about 40-60 seconds, it crashes.
By asking to the users, I have determinate that the problem is only in those devices that haves iOS4 (iPhone 3Gs and 4G).
I tested the app over and over in my simulator and my device but it never happens to me!! Some one have any idea or information about this?
I will really appreciate it. Thanks.
After search for the crashes, and try over and over, I can't reproduce the bug on
my devices. So, I decide to start reading at the Apple Developer Forums and I
found a thread where my suspicions are affirmed: this problem is caused by an internal
iOS4 bug.
"There's a bug in the App Store's code signing process. Talk to DTS: they can
help you with the workaround. Mention rdar://7909951."
"...but it should be the cause of nearly all "failed to launch in time" inside
libobjc:_mapStrHash..." (This appears in some of my app crashes)
Here is the link to the post: failed to launch in time in iOS4
There is no certain solution, but some suggest that a start is changing from arm6 to arm7 and try.
You can try changing some code in the app for producing a different binary and submit it again.
I hope it can help anyone else.
Check the crash report on itunesconnect.apple.com
iPhone 3G also supports iOS 4, except it "doesn't support multitasking" (presumably due to lack of RAM?). If you're only seeing crashes on the 3GS and 4, then that might be the issue.
Default.png is shown on launch, but it's also shown on the foreground when the OS didn't manage to get a screenshot while backgrounding, or for various other reasons (e.g. your app was launched with openURL, so the UI is likely to be different).

What are the potential issues of jail-breaking to test the new background APIs on a 3G?

I've registered/paid for the iPhone developer program, which allows me to test apps on a device. I have an old 3G that I would like to use. However, I'm interested in using the significant change notifications as well as it working in the background.
If I were to jailbreak to enable background processing and things like that, what issues could I have, and how likely are they to arise?
EDIT:
I actually do have an iPhone4, but I'm using it for my personal phone. I've heard that it's not to great of an idea to use your everyday phone as a development device. I've done a little more reading, looks like I could use Ad-Hoc distribution to test while avoiding the problems of using your primary phone as a development device. Seems like the only downside of this would be no debug info, other than logs.
iOS 4 has been hacked to allow home screen wallpapers and multitasking on iPhone 3G. (http://pixelatedgeek.com/2010/06/ios4-jailbreak-and-multitasking-now-available-for-iphone-3g/)
It seems to be running fine without any issues, probably not as fast as an iPhone 3GS or iPhone 4.
Just be careful if you use this as your main testing device and make sure you test on supported hardware before releasing. Personally, I'd use something that was 100% supported to be sure everything worked as expected. However, if you don't own a supported device this may not be possible.
Again, make sure you test on friends 3GS or 4 before releasing. I don't foresee any major issues, but testing features on hardware that isn't officially supported could cause problems.
Update: I've used my phone for development purposes before and haven't run into any earth shattering problems. If an issue comes up you can always restores your device.
If you are planning to target iOS4 you really, really really should spring for an iPhone4. You can understand how things will run on it, and also be able to see how the higher resolution display interacts with your app. I'm not sure running iOS4 on a hacked 3G will tell you much more than running in the simulator, and in fact because of the reduced memory may show some issues that just do not occur on real devices.
One other great option is a recent generation Touch. Although it doesn't give you the display to check against it is a good test platform for multitasking.