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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -