iphone - Add Variable to writeToFile:atomically: -


i writing simple ios app saves tasks table. wanted expand app , allow people share there "lists" other people. before saving xml or url wanted try local file using writetofile:atomically:. worked great. needed file unique person using wanted make file unique title of the list. title field uitextfield. tasks mutable array here code:

- (void)savetask:(id)sender; { nsstring * original = [titlefield text]; nsstring * file = [nsstring stringwithformat:@"%@.plist", original];   [tasks writetofile:@"/tmp/%@.plist",file          atomically:yes]; } 

i error wanting me add ":" middle of automatically. how can use variable in writetofile:atomically:? if none of makes sense please let me know can add something. thank you.

with you're doing, you'll end file has .plist.plist extension.

beside, reason why error is, code should this

[tasks writetofile:[nsstring stringwithformat:@"/tmp/%@.plist",file]          atomically:yes]; 

this might wanted

- (void)savetask:(id)sender; {     nsstring * original = [titlefield text];     nsstring * file = [nsstring stringwithformat:@"%@.plist", original];      [tasks writetofile:[nsstring stringwithformat:@"/tmp/%@", file]              atomically:yes]; } 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -