0

アプリが起動したら、ftp 上のファイル数と CoreData エンティティ内のデータ数を比較する必要があります。また、ftp 上のファイル数がエンティティ内のデータ数よりも多い場合、アプリケーションはダウンロードを開始します。

自分の ftp フォルダーにある json ファイルの数を知るにはどうすればよいですか?

編集

これは ftp への接続のコードです:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"ftp:...json"]];
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];

NSError *error = nil;
if (!responseData) {
    return;
}

NSDictionary *ingredientsDictionary = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
if (!ingredientsDictionary) {
    return;
}

//inserting to CoreData
4

0 に答える 0