0
Возможно ли получить содержимое URL-адреса iCloud без необходимости проходить через UIDocument?Получить данные содержимого URL-адреса iCloud без UIDocument
Возможно ли получить содержимое URL-адреса iCloud без необходимости проходить через UIDocument?Получить данные содержимого URL-адреса iCloud без UIDocument
Вы можете использовать следующий код для понижения содержания URL-адреса icloud без создания объекта NSDocument. Это будет сработано для меня ...
-(void)loadData:(NSMetadataQuery *)query
{
if ([query resultCount] == 1)
{
NSMetadataItem *item = [query resultAtIndex:0];
NSURL *fromURL = [item valueForAttribute:NSMetadataItemURLKey];
NSURL *toURL=[NSURL fileURLWithPath:@"PATH_OF_FILE_TO_STORE_DATA"];
NSFileCoordinator *coordinator = [[NSFileCoordinator alloc] initWithFilePresenter:nil];
[coordinator coordinateReadingItemAtURL:fromURL options:0 writingItemAtURL:toURL options:NSFileCoordinatorWritingForReplacing error:nil byAccessor:^(NSURL *newReadingURL, NSURL *newWritingURL)
{
[[NSFileManager defaultManager] removeItemAtPath:newWritingURL.path error:NULL];
[[NSFileManager defaultManager] copyItemAtPath:newReadingURL.path toPath:newWritingURL.path error:nil];
}];
}
}
Короткий ответ: да. Длинный ответ: я не могу предоставить код прямо сейчас, но я сделал это некоторое время назад. Возможно, вам захочется найти документацию на яблоки для «Ubiquity Container». – Atomix