Overwriting/Dynamically replacing Default.png

Discussion in 'iOS Programming' started by roeik, Aug 25, 2009.

  1. roeik macrumors member

    Joined:
    Dec 25, 2008
    #1
    Hi All,

    My users need to download a data file once a week, so while they are downloading the data file I would like them to also download a new Default.png file I will store on a web server, so that they will see a different image the next time they load the app.

    I already wrote the downloading algorithm, and I get the Default.png file to be stored in the "Documents" folder of the local library. How do I now move it (or directly stoer) to the images library, overwriting the existing file?
    Any ideas?

    I found this article, http://collison.ie/blog/2008/11/dynamic-defaultpng-files-on-the-iphone, but I need to figure out if there is a better way to store the image.

    Thanks.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Instead of trying to make Default.png dynamic, why don't you just present a modal view until the data has finished downloading?
     
  3. roeik thread starter macrumors member

    Joined:
    Dec 25, 2008
    #3
    Because it takes my software 6-8 seconds to load, and I don't want to display another screen for 6 more seconds after the program loads.

    I tried before to take out all the commands from the awakeFromNib function and decompose them in other functions which I call from ApplicationDidFinishLoading in the applicationDelegate, but it completely messes up my program and I get tons of bugs.

    If I could just overwrite the Default.png file it would be ideal.
     
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    awakeFromNib is probably not the correct place(s) for you do be doing all your "heavy-lifting". I think it would be much better to figure out how to place the burden of that work in spawned threads, called from applicationDidFinishLaunching:. Seems you are using awakeFromNib for something it's not really intended for, which is more UI setup related.
     
  5. North Bronson macrumors 6502

    Joined:
    Oct 31, 2007
    Location:
    San José
    #5
    I don't think Apple makes this available to developers. The code is obviously there -- just look at Mail. This might be in a new SDK version. Who knows?

    You might find a hack somewhere on the internet.
     
  6. Troglodyte macrumors member

    Joined:
    Jul 2, 2009
    #6
    I think the problem with trying to change Default.png at runtime is that it's part of the app bundle and as such will be signed. If you change something in the bundle that will break the code signing and the app will not run. At least that's my understanding. Obviously some of the Apple apps are doing something like this without breaking but i wouldn't be surprised if apple built in specific exceptions for them.
     
  7. mccannmarc macrumors 6502

    mccannmarc

    Joined:
    Aug 15, 2008
    Location:
    Manchester, UK
    #7
    It used to be able to be done by making default.png a symlink to an image in the documents directory as you have full control over them. It was never official though and I'm not too sure if Apple patched it as it was screaming out to be exploited in some way or another by the jailbreakers.

    Mail probably does a similar thing by taking a screenshot of the app on exit and setting it up to be used as the apps default.png on the apps next launch.

    You are better off taking dejo's advice and making the loading of your app asynchronous by using a seperate thread(s) for doing your heavy loading whilst still allowing your UI to breathe. This way your default.png would hardly show and you could load in a view that can be dynamic.
     

Share This Page