ios - how can i populate dictionary with contents of url .txt file -
i saved dictionary contents in server , server automatically converted .txt file how can load contents url nsdictionary?
i using code:
nsdictionary *data = [[nsdictionary alloc]initwithcontentsofurl:[nsurl urlwithstring:url]]; url https://www.example.com/files/admin.txt
how load nsdictionary?
i getting null values when type url in browser file contents.
i got answer
nsdictionary *dict; nsstring *url=@"https://example.com/admin.txt"; nsmutabledictionary *str=[[nsmutabledictionary alloc]init]; str=[nsdictionary dictionarywithcontentsofurl:[nsurl urlwithstring:url]]; nsmutablearray *a=[[nsmutablearray alloc]init]; [a addobject:[str objectforkey:@"bookmarks"]]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *path = [[paths objectatindex:0] stringbyappendingpathcomponent:@"bookmarks.plist"]; [a writetofile:path atomically:yes]; thanks help
Comments
Post a Comment