nsfilecoordinator

Rename an iCloud document

会有一股神秘感。 提交于 2021-02-09 05:12:38
问题 The problem What I have so far is code that creates a new local file and deletes the iCloud file. Is it possible to rename an iCloud document, so that it stays in iCloud? GarageBand can do it. It's possible to rename an iCloud song. After the rename is done, the song is still in iCloud. However GarageBand is an Apple app, so it may use private apis. My current code: - (void)moveFrom:(NSURL*)sourceURL moveTo:(NSString*)destinationName completion:(void (^)())completion { MyDocument *document =

Rename an iCloud document

☆樱花仙子☆ 提交于 2021-02-09 05:08:05
问题 The problem What I have so far is code that creates a new local file and deletes the iCloud file. Is it possible to rename an iCloud document, so that it stays in iCloud? GarageBand can do it. It's possible to rename an iCloud song. After the rename is done, the song is still in iCloud. However GarageBand is an Apple app, so it may use private apis. My current code: - (void)moveFrom:(NSURL*)sourceURL moveTo:(NSString*)destinationName completion:(void (^)())completion { MyDocument *document =

Rename an iCloud document

一曲冷凌霜 提交于 2021-02-09 05:05:54
问题 The problem What I have so far is code that creates a new local file and deletes the iCloud file. Is it possible to rename an iCloud document, so that it stays in iCloud? GarageBand can do it. It's possible to rename an iCloud song. After the rename is done, the song is still in iCloud. However GarageBand is an Apple app, so it may use private apis. My current code: - (void)moveFrom:(NSURL*)sourceURL moveTo:(NSString*)destinationName completion:(void (^)())completion { MyDocument *document =

Rename an iCloud document

微笑、不失礼 提交于 2021-02-09 05:04:41
问题 The problem What I have so far is code that creates a new local file and deletes the iCloud file. Is it possible to rename an iCloud document, so that it stays in iCloud? GarageBand can do it. It's possible to rename an iCloud song. After the rename is done, the song is still in iCloud. However GarageBand is an Apple app, so it may use private apis. My current code: - (void)moveFrom:(NSURL*)sourceURL moveTo:(NSString*)destinationName completion:(void (^)())completion { MyDocument *document =

Reading files from external storage in iOS 13

不问归期 提交于 2020-03-19 05:04:37
问题 I have an iOS app that is trying to read files from an external storage device without importing them into the App's sandbox. I have followed Apple's documentations outlined here to do this -- Providing Access to Directories I'm able to retrieve the selected directory ( which is on an external storage device connected via the Lightning port ) and enumerate the files inside the directory. However, when I try to do something with those files as per the recommended pattern, I get a failure and

Reading files from external storage in iOS 13

a 夏天 提交于 2020-03-19 05:01:07
问题 I have an iOS app that is trying to read files from an external storage device without importing them into the App's sandbox. I have followed Apple's documentations outlined here to do this -- Providing Access to Directories I'm able to retrieve the selected directory ( which is on an external storage device connected via the Lightning port ) and enumerate the files inside the directory. However, when I try to do something with those files as per the recommended pattern, I get a failure and

NSFilePresenter methods never get called

与世无争的帅哥 提交于 2020-02-28 04:58:47
问题 I'm trying to write a simple (toy) program that uses the NSFilePresenter and NSFileCoordinator methods to watch a file for changes. The program consists of a text view that loads a (hardcoded) text file and a button that will save the file with any changes. The idea is that I have two instances running and saving in one instance will cause the other instance to reload the changed file. Loading and saving the file works fine but the NSFilePresenter methods are never called. It is all based

Sharing data between app extension and conainer app

折月煮酒 提交于 2020-01-16 00:42:11
问题 I'm trying to share data between an app extension and my container app. I setup an app group in the container app and referenced it my app extension. When my app extension is accessed, I save an object to NSUserDefaults //in the app extension -(void)viewDidLoad { NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"group.mygroup.com"]; [defaults setObject:[NSDate date] forKey:@"Date"]; [defaults synchronize]; } and in the container app - when it is launched I setup an

App hangs deleting iCloud Document when following  guideline using NSFileCoordinator and DispatchQueue

♀尐吖头ヾ 提交于 2020-01-05 08:52:46
问题 I have a todo list app that stores document in iCloud as UIDocument object. The following function in the table view controller is created to delete a todo list item both locally and remotely in iCloud but hang the app when executed it via swipe to delete gesture on the table view cell: fileprivate func deleteNote(at indexPath: IndexPath) { let noteDocument = self.noteDocuments[indexPath.row] let fileCoordinator = NSFileCoordinator(filePresenter: nil) fileCoordinator.coordinate(writingItemAt:

App hangs deleting iCloud Document when following  guideline using NSFileCoordinator and DispatchQueue

谁都会走 提交于 2020-01-05 08:51:41
问题 I have a todo list app that stores document in iCloud as UIDocument object. The following function in the table view controller is created to delete a todo list item both locally and remotely in iCloud but hang the app when executed it via swipe to delete gesture on the table view cell: fileprivate func deleteNote(at indexPath: IndexPath) { let noteDocument = self.noteDocuments[indexPath.row] let fileCoordinator = NSFileCoordinator(filePresenter: nil) fileCoordinator.coordinate(writingItemAt: