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

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -