Objective C reading array from file fails on different locations
I am developing a mac app and I want to put my settings (array of strings)
into a file. If that file exists in the same folder as the app it is read
and it overwrites default settings.
No problems writing the file but when reading with code:
NSArray* settingsInput = [[NSArray alloc]
initWithContentsOfFile:@"./SettingsFile"];
something strange happens. When running the app from XCode (the settings
file is in the build/debug folder next to the app) settings are read
without a problem. When I archive the app and run it from the desktop, the
file cannot be loaded. Even when I copy the app from the build folder to
the desktop it does not work.
What could be the reason for this kind of behaviour? How can I read this
file?
No comments:
Post a Comment