0

Ok, it may sounds stupid but I need the find a piece of code the warms the iPhone quickly and doesn't freeze the whole app. Does anyone has ever deal with heat and phones?

Simone D'Amico
  • 2,335
  • 3
  • 17
  • 21
  • 3
    You mean like physical temperature up? Why? You are making an app for antarctica people? – Dunes Buggy Nov 23 '13 at 10:38
  • And maybe running a forever while loop on a thread might help you, btw. – Dunes Buggy Nov 23 '13 at 10:40
  • Draining the battery for warming up is a ridiculous idea. A battery is even more efficient if it is not too hot. If the display suffers from low temperatures, just put the device in your pocket. – CouchDeveloper Nov 23 '13 at 10:45
  • This won't get approved for the App Store. – HAS Nov 23 '13 at 10:48
  • The app is for an hackhaton and already uses some private APIs, I don't care if it doesn't get approved. Read the comment on the answer below. – Simone D'Amico Nov 23 '13 at 10:49
  • Be a little careful. I once damaged a Nokia phone (actually melted glue holding the screen together) by leaving it stuck in a loop while on a charger. (The loop was due to an OS bug related to cast checking.) – Hot Licks Nov 23 '13 at 12:42

2 Answers2

6

The question is weird but I will take a shot at it. Any mishap, like iPhone blowing up etc. if it occurs is not my responsibility. I am assuming you are well aware of what you are doing.

Quickest ways to "warm" your iPhone is to do 2 things (amongst others).

  1. Run CPU intensive code (eg. calculate Pi to the nth digit)
  2. Start using GPS+Location tracking with 10m accuracy with highest possible location updates.

To run CPU intensive tasks you spawn (say 5) background threads & run infinite some while loops. Also start (5 more) location updates based background threads & subscribe for location updates with the above discussed specs.

Note that any operation which consumes too much battery power is bound to heat up your iPhone. See here for more - What are the most battery-consuming things you can do in an iPhone-app?

Do you mind me asking why are you doing this ?

Community
  • 1
  • 1
Srikar Appalaraju
  • 71,928
  • 54
  • 216
  • 264
  • I'm doing an app for an hackathon, basically the iPhone it will act as an (expensive) heat stone. I was thinking about something CPU intensive but I don't want to stuck the since it's doing networking and playing music among other stuff. – Simone D'Amico Nov 23 '13 at 10:46
  • spawn a background thread & do any such operations there. It should not freeze your UI (since UI runs on main thread). – Srikar Appalaraju Nov 23 '13 at 10:48
  • 1
    I suspect you'd be better off keeping the GPU busy. Constantly animating a huge pile of overlapping transparent views will probably achieve that. – marko Nov 23 '13 at 11:07
  • @SimoneD'Amico what approach(s) did you finally take? – Srikar Appalaraju Nov 24 '13 at 11:38
  • @SrikarAppal A GCD thread that runs a while loop that check a boolean to know when the phone is hot enough :D I'll put the source on Github, it's a remote massager app: multiple devices heating and vibrating controlled by a leap motion massager. – Simone D'Amico Nov 24 '13 at 15:03
1

The best option is to run NSRunLoop continuously with very small interval.

while(TRUE)
{
    [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.0001]];
}
Apurv
  • 17,116
  • 8
  • 51
  • 67