私のiOSアプリケーションでは、私はplistにデータを提出する必要があるフォームを作った。私のPlistにファイルを追加 - 私はほとんどそこにいると思う。
は今、私は私は1つのエラーを取得していますし、それがARCに関連している権利以外のすべてを行っていると思います - - 私は他の中、このリンクから例をたどってきたので、私は例があれば確認していない - Xcodeの言います私は時代遅れであるか、私は何かを忘れてしまった。
明確にするには - 私は適切な - (IBAction)で保存ボタンを持っており、エラーがないので、私はそこにいると思います。私が思う微調整が必要なビットは、元のData.plistをドキュメントフォルダにコピーして、これで実現すると思います。
以下にエラーが発生したコードを貼り付けました。すべてのヘルプは素晴らしいですし、私はより多くのコードを投稿することで助けることができるならば、私に知らせて
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
NSString *destPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
destPath = [destPath stringByAppendingPathComponent:@"Data.plist"];
// If the file doesn't exist in the Documents Folder, copy it.
NSFileManager *fileManager = [NSFileManager defaultManager];
if (![fileManager fileExistsAtPath:destPath]) {
NSString *sourcePath = [[NSBundle mainBundle] pathForResource:@"Data" ofType:@"plist"];
[fileManager copyItemAtPath:sourcePath toPath:destPath];
}
// Load the Property List.
savedReadingsDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:destPath];
}
乾杯ジェフ:-)
私はちょうど私が私にエラーを与えているものを明らかにしませんでした気づい:
それは、このライン
[fileManager copyItemAtPath:sourcePath toPath:destPath];
だとエラーは次のとおりです。
ARC Issue - No visible @interface for 'NSFileManager' declares the selector 'copyItemAtPath:toPath:'
それはエラーを取り除くように見えました - なぜ私はNSDictionaryの問題を取得しています - あなたに感謝:-) –
問題のない男!次の問題で幸運! – tipycalFlow