ios - How to get Source URL from -(bool) application openURL? -
i have app opens pdf http url using -(bool)application:openurl:
. go safari, open pdf in safari, , use [open in "myapp"]
i want save url, when user closes app , opens again, pdf can opened again.
-(bool)application:(uiapplication *)application openurl:(nsurl *)url { nsuserdefaults *defaults = [nsuserdefaults standarduserdefaults]; // store [defaults setobject:[url absolutestring] forkey:@"lastpdfurl"]; [defaults synchronize]; <...etc...> return yes; }
when load key lastpdfurl
, instead of getting:
(nsstring*) @"http://www.somewebsite.com/lastpdf.pdf"
i local url after pdf imported app, like:
(nsstring*) @"file:///<..dir..>/developer/coresimulator/devices/<..deviceid..>/ data/containers/data/application/<..appid..>/documents/inbox/lastpdf.pdf"
so question is:
is possible in file importing interaction source url importing performed? i.e. "http://www.somewebsite.com/lastpdf.pdf"?
you don't original url. when choose launch app safari or mail (or other apps) open sort of file, original file copied app's sandbox , url copied file in sandbox. can't change this.
there no way know original url was.
what should move file supplied url more appropriate location within app's bundle (such documents) , keep reference there. when app restarts can access previous file local location.
Comments
Post a Comment