nsdocumentdirectory

Swift -How to know if a file was successfully saved in .cachesDirectory

白昼怎懂夜的黑 提交于 2020-08-10 01:19:48
问题 I have a .mp4 video saved in Firebase and I want to save it to the .cachesDirectory . I want to make sure it is saved and tried to use a do-try block but it wouldn't accept it: No calls to throwing functions occur within 'try' expression. How else can I check to see if the file was successfully saved to the .cachesDirectory ? let fbStr = "https://firebasestorage.googleapis.com/v0/b/myApp.appspot.com/o/abcd%277920FHqFBkl7D6j%2F-MC65EFG_qT0KZbdtFhU%2F48127-8C29-4666-96C9-E95BE178B268.mp4?alt

Swift -How to know if a file was successfully saved in .cachesDirectory

风格不统一 提交于 2020-08-10 01:17:22
问题 I have a .mp4 video saved in Firebase and I want to save it to the .cachesDirectory . I want to make sure it is saved and tried to use a do-try block but it wouldn't accept it: No calls to throwing functions occur within 'try' expression. How else can I check to see if the file was successfully saved to the .cachesDirectory ? let fbStr = "https://firebasestorage.googleapis.com/v0/b/myApp.appspot.com/o/abcd%277920FHqFBkl7D6j%2F-MC65EFG_qT0KZbdtFhU%2F48127-8C29-4666-96C9-E95BE178B268.mp4?alt

Error excluding ApplicationSupportDirectory from Backup

断了今生、忘了曾经 提交于 2020-01-25 09:52:07
问题 MY App got rejected because it backsUp too much data to iCloud. In order to solve the problem, I have to put all of my files in a new directory, located in ApplicationSupportDirectory. I am not managing to do it so far and I cannot figure out what seems to be the problem. This is my code so far: AppDelegate.m class: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions { NSString* string = [[self applicationDocumentsDirectory]

Copy images from an app to Documents Directory and rewrite them after it

房东的猫 提交于 2020-01-05 03:43:11
问题 I have an app where I have a certain amount of .jpg pictures (roughly 300). They serve as something to start with, because they're actually located in the internet, but obviously it's more convenient for user not to download all of them at the first start of the App, but to have them pre-packed. I am required to rewrite these images everytime I get new information from server. Obviously, I can't touch the app bundle, so I see my steps like this: Unpack the images from bundle to the Documents

Is it even possible for one iOS app to access another app's Caches directory?

孤街浪徒 提交于 2019-12-25 15:55:40
问题 I'm writing a unit test with GHUnit. I would like to check if a file is being generated in the Caches directory within the Library directory of another app. Is this feasible, or are apps prevented from accessing each others' Library directories? And if so, are there any possible workarounds for creating a unit test for this? Could I possibly store the generated file in a different directory, such as Documents, or would that not help? 回答1: I don't understand the context that you're attempting

Get images from Document Directory not file path Swift 3

时光毁灭记忆、已成空白 提交于 2019-12-25 08:48:31
问题 This is how I saved the images let format = DateFormatter() format.dateFormat="MMMM-dd-yyyy-ss" let currentFileName = "\(format.string(from: Date())).img" print(currentFileName) // Save Images let fileMgr = FileManager.default let dirPath = fileMgr.urls(for: .documentDirectory, in: .userDomainMask)[0] let imageFileUrl = dirPath.appendingPathComponent(currentFileName) do { try UIImagePNGRepresentation(returnedImages)!.write(to: imageFileUrl) print("Image Added Successfully") } catch { print

Encrypting or protecting files stored in iOS app's NSDocumentsDirectory

陌路散爱 提交于 2019-12-25 04:55:19
问题 I have a custom requirement in one of my products and I need to protect or encrypt files that are stored inside the NSDocumentsDirectory folder. Even if these documents are mailed (The app has the ability to mail documents) to some other person , he or she will not be able to open this document without using my app (I will be using open in functionality of email attachments). So basically only the application can access all these documents and without the app the documents should be mere junk

Saving and accessing audio recordings

情到浓时终转凉″ 提交于 2019-12-25 01:14:36
问题 Ok so im kind of new to objective-c. I set up an audio recorder using AVAudioRecorder. It works great. but.... i dont know how to access the saved files, heck i dont even know if they get saved. The program is saving them to NSDocumentsDirectory under the name "sounds.caf" at least temporarily. I want to know if these are being permanently saved, if not, then how can i make it so. And then how can i access them after they are saved. Thanks for the help. Also as a side note id like to know if

saving image to documents directory no longer works iOS8

寵の児 提交于 2019-12-22 11:22:54
问题 Saving images to the documents directory does not seem to working anymore in iOS8. I had hear that there was Changes To App Containers In iOS 8. But I still cant seem to get my code to work. I save an image to the documents directory, and retrieve it later to use. Here is my code for saving the image in the documents directory; -(void) simpleCam:(SimpleCam *)simpleCam didFinishWithImage:(UIImage *)image { if (![UIImagePickerController isSourceTypeAvailable

NSDocumentDirectory files disappear in ios

人盡茶涼 提交于 2019-12-22 08:16:13
问题 I want to save a mp4 video in my folder but when I open again the app, this file is nil. But when I save the file, I can open it, so it seems that it disappears from the folder. Save: NSData *videoData = [NSData dataWithContentsOfURL:exportUrl]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *tempPath = [documentsDirectory stringByAppendingFormat:@"/%@",videoName]; self.path