cocoa touch - Objective C: Write a file programmatically to the Main Bundle -


possible duplicate:
writing file objective c

how create , write file bundle? have this:

//make path file nsstring* documentspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory,    nsuserdomainmask, yes) objectatindex:0]; nsstring *filepath = [documentspath stringbyappendingpathcomponent:[nsstring stringwithformat:@"usnews.txt", [sharedmanager.articlenumber intvalue] + 1]]; //write file [textcontent writetofile:filepath atomically:yes encoding:nsutf8stringencoding error:nil]; 

but writes documents folder , deleted when app closed.

you can’t write main bundle on ios. contents cryptographically signed part of app store submission process; modifying contents prevent application running.

documents shouldn’t deleted when app closed. try passing in nserror receive error messages on write. also, sure file writing location think? use filename:

[nsstring stringwithformat:@"usnews.txt", [sharedmanager.articlenumber intvalue] + 1] 

but don’t have %d format specifier in it, number never inserted filename.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -