3

My app is jailbroken and I don't have to submit it to the app store.The problem is the ios kills my app after 2 or 3 hours.I have used the static analyzer from xcode and removed all memory leaks.I have even installed a memory monitor.There is atleast 300 mb of free memory when the ios kills my app.Is there any way to prevent the ios from killing my app?

zzzzz
  • 1,209
  • 2
  • 18
  • 45
  • Maybe check the crash log, see the real reason why your app is being killed. Not necessarily excessive memory, it could be an unhandled exception – gerrytan Mar 27 '13 at 06:24
  • @gerrytan its not an exception.The crash says received memory warning.Failed to save crash report to blah blah blah – zzzzz Mar 27 '13 at 06:32
  • Are you talking about your app being killed while it's still in the foreground, or being killed in the background (after user has pressed home button, etc.)? – Nate Mar 27 '13 at 07:03
  • My app always runs in the background – zzzzz Mar 27 '13 at 07:04
  • Is it a Launch Daemon, or a normal app with a UI? – Nate Mar 27 '13 at 07:06
  • the app does not have a UI – zzzzz Mar 27 '13 at 07:08
  • But, how is it **started**? Do you have an icon on the home screen, or have you installed a .plist under `/System/Library/LaunchDaemons/` to make it start automatically when the phone boots? And, is it installed in `/Applications/`, or `/var/mobile/Applications/*/`? – Nate Mar 27 '13 at 07:09
  • i hava installled a .plist – zzzzz Mar 27 '13 at 07:10
  • You might [also take a look at this answer, if you're concerned about a memory issue](http://stackoverflow.com/a/2915477/119114) – Nate Mar 27 '13 at 07:16
  • @Nate Dude Can you help me with this question? http://stackoverflow.com/questions/15653779/how-do-i-use-this-class-in-my-project I would really appreciate your help – zzzzz Mar 27 '13 at 07:41
  • 1
    You can also may be interested to see a discussion about daemons and background apps here -http://stackoverflow.com/questions/15025174/pull-notification-locally-on-jailbroken-device/15454926#15454926 – Victor Ronin Mar 27 '13 at 14:33

1 Answers1

2

Try playing a silent audio file in a loop using AVAudioPlayer. iOS won't shut down your app if it's playing.

See: http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW24

Also SO: How to handle background audio playing while iOS device is locked or on another application?

Community
  • 1
  • 1
Richard Brown
  • 11,346
  • 4
  • 32
  • 43