Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to minimise Xcode file

edited June 2015 in Questions Posts: 371

Hey Guys, been a while since I've popped in...

I've developed an app for my own usage (a simple timer that involves basic graphics, touch, and sound) and I had installed it using Xcode-beta without a developer license.

The app uses a crazy amount of battery, and even some mobile data (without any network functions) on my iPhone 5, so I was wondering, is there any way to fix this and otherwise minimise the app footprint on a device? Possibly remove extra libraries, cut out unnecessary functions (within reason of course, I don't need to remove the code for print() :) )

Thanks,
Jordan

Comments

  • SimeonSimeon Admin Mod
    Posts: 4,844

    @Jordan sorry about the battery use. It happens because Codea is designed primarily around motion graphics. That is, it continuously renders the screen at 60 frames per second.

    For apps such as timers that update infrequently this is overkill. It would be necessary to add a special mode where you update the screen yourself, instead of having draw() called automatically. Although this would then remove a lot of the simplicity of Codea.

    The mobile data usage shouldn't happen unless explicitly requested (http.request). I'll look into that.

  • Posts: 211

    @Simeon, maybe openURL?

  • Posts: 289

    whats the differrence between minimise and optimise?

  • DylanDylan Admin Mod
    Posts: 121

    @simeon you could have a targetFPS api call that could then be set to 1 to only draw every second.

  • SimeonSimeon Admin Mod
    Posts: 4,844

    @Dylan yeah, the target fps could increase the frame interval on the display link (would have to be 60, 30, 15, 7.5, 3.75).

    Alternatively we could introduce an update() loop from which draw() can be called manually. The update loop could be run in sync with the app's regular event loop.

  • Posts: 371

    @Simeon, I think I'm just stuck then. My timer updates pretty much every millisecond, with subtle animations too - only solution to the battery issues would be to recode the entire thing in Xcode, and that seems like too much effort for such a small gain..

Sign In or Register to comment.