ios - Saving a UIImage as a PNG, can't load image after restarting app -



ios - Saving a UIImage as a PNG, can't load image after restarting app -

i using save uiimage png

nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; nstimeinterval timeinmiliseconds = [[nsdate date] timeintervalsince1970]; nsstring *generatedstring = [nsstring stringwithformat:@"background%f.png", timeinmiliseconds]; nsstring *pngpath = [documentsdirectory stringbyappendingpathcomponent:generatedstring]; [uiimagepngrepresentation(custombackground) writetofile:pngpath atomically:yes];

i saving pngpath plist above using string in this:

uiimage *image = [uiimage imagewithcontentsoffile:string];

as string, string shows right , can see image file @ exact location shows.

now unusual part long don't close app method works fine, if close , reopen app uiimage file stays nil. thoughts?

i idiot...

the string saved , retrieved missing "/" between documents , file name. added in , works. i'm curious how ever worked when app never closed. help guys. :)

ios objective-c uiimage

Comments

Popular posts from this blog

java Multi query from Mysql using netbeans -

c# - DotNetZip fails with "stream does not support seek operations" -

c++ - StartServiceCtrlDispatcher don't can access 1063 error -