Where to put txt file when running iOS simulator -
i building simple ios app. , need read data text file. don't know put it.
i have tried put under debug-iphoneos or debug-iphonesimulator. doesn't work.
drag project. when asked if should part of app target, make sure is. result when build app, file copied app bundle , make way onto target device part of app, code can retrieve it, along these lines:
nsstring* f = [[nsbundle mainbundle] pathforresource:@"myfile" oftype:@"txt"]; nserror* err = nil; nsstring* s = [nsstring stringwithcontentsoffile:f encoding:nsutf8stringencoding error:&err];
Comments
Post a Comment