nsfilemanager

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 =

The file “xxx” couldn’t be opened because there is no such file [duplicate]

心已入冬 提交于 2021-02-08 13:04:24
问题 This question already has answers here : UIImage(contentsOfFile:) returning nil despite file existing in caches directory [duplicate] (1 answer) NSFileManager.defaultManager().fileExistsAtPath returns false instead of true (2 answers) Closed 3 years ago . I would like to open a .txt file and save the content as a String. I tried this: let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("xxx.txt") var contentString = try String

The file “xxx” couldn’t be opened because there is no such file [duplicate]

狂风中的少年 提交于 2021-02-08 13:03:52
问题 This question already has answers here : UIImage(contentsOfFile:) returning nil despite file existing in caches directory [duplicate] (1 answer) NSFileManager.defaultManager().fileExistsAtPath returns false instead of true (2 answers) Closed 3 years ago . I would like to open a .txt file and save the content as a String. I tried this: let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("xxx.txt") var contentString = try String

Is there an API for iCloud disk capacity and usage?

不问归期 提交于 2020-08-24 05:28:33
问题 I use NSFileManager to get the current device disk space (total, used, and free) like so... let systemAttributes = try? NSFileManager.defaultManager().attributesOfFileSystemForPath(NSHomeDirectory() as String) let space = (systemAttributes?[NSFileSystemSize] as? NSNumber)?.longLongValue Is there any way to do something similar for a user's iCloud account? I want to be able to present a user's iCloud disk space statistics within an app. 回答1: Capacity iCloud online capacity is determined by

Download in documents directory or move file async - iOS

◇◆丶佛笑我妖孽 提交于 2020-07-17 09:51:26
问题 I am building an iOS app in which the user can download different files. I am using an URLSessionDownloadTask and an URLSession to download a file asynchronously. When the download is finished, the destination folder is by default, the tmp/ directory. So, when the download ends, I need to move the temporary file to another directory. For a picture or a song, this takes only 1 second maybe even less. But when the file is a video for example, it can take up to 15 seconds. The issue To allow the

How do I enumerate through a directory in Objective-C, and essentially clear out all the directories of non-directory files?

扶醉桌前 提交于 2020-02-03 02:10:16
问题 How do I iterate through a folder (with subdirectories that might have further subdirectories in them) and delete the file if it's not a directory? Essentially, I'm asking how to clear all the directories. I'm having a little trouble with the enumeratorAtPath: method in this regard, because I'm not sure how to ask the enumerator if the current file is a directory or not. Does require looking through the fileAttributes dictionary. Note: This may be very wrong of me, but I initialize the

Get all URLs for resources in sub-directory in Swift

主宰稳场 提交于 2020-02-01 03:11:24
问题 I am attempting to create an array of URLs for all of the resources in a sub-directory in my iOS app. I can not seem to get to the correct path, I want to be able to retrieve the URLs even if I do not know the names (i.e. I don't want to hard code the file names into the code). Below is a screen shot of the hierarchy, I am attempting to get all the files in the 'test' folder: Any help is greatly appreciated, I have attempted to use file manager and bundle main path but to no joy so far. This