nsfilemanager

Get File from device while debugging

我的未来我决定 提交于 2019-12-13 05:19:46
问题 I am creating a application in which I am writing dictionary in a plist file using device. I need that file in my Mac. As if I use simulator I can access my document dir coz this is accessible. How can get that file in my mac or my code while I am using device and application is in debug mode. Please help me Thanks 回答1: Enable UIFileSharingEnabled in your Info.plist file. Then, copy the plist to Documents folder. The file will be accessible in iTunes Apps tab, File Sharing section. Copy it to

Why is NSDirectoryEnumerator picking up hidden files here?

断了今生、忘了曾经 提交于 2019-12-13 04:35:17
问题 i need to avoid hidden files in this enumeration, but .DS_Store files are still being added. i put in the NSLog to check, and i am getting output there. there's probably something obvious, but i can't see it. NSDirectoryEnumerator *dirEnumerator; NSFileManager *fileManager = [[NSFileManager alloc] init]; dirEnumerator = [fileManager enumeratorAtURL:item includingPropertiesForKeys:[NSArray array] options:NSDirectoryEnumerationSkipsPackageDescendants || NSDirectoryEnumerationSkipsHiddenFiles

iOS - Reading an Audio file from Documents Directory

梦想的初衷 提交于 2019-12-13 01:10:32
问题 I am saving audio data to the Documents directory and trying to read it back. If I play it back immediately it plays successfully, however, if I start a new session and try and play the song locally it will fail even though listing the files in the Documents directory shows that my file is still there. Note that the file is played back from the Documents folder in the same way (same code) if it is played immediately or during a new session. Here is how I save the audio data to the Documents

Cache Facebook Profile Picture iOS

大兔子大兔子 提交于 2019-12-12 19:19:33
问题 I'm saving images to disk for my app users, who either upload a picture or connect with facebook and we display their profile picture. This works great, but if a user changes their facebook profile picture, the code below never updates the image. How can I check the facebook graph api to check if the image has been uploaded without redownloading the image? I am using AFNetworking so checking the 302 header is an option if its possible-just not sure how to implement. //load image if exists on

iOS: Saving audio file visible in iTunes Library

て烟熏妆下的殇ゞ 提交于 2019-12-12 19:16:02
问题 I am trying to save a mp3 file into a folder where the file could be visible in iTunes Library. I read somewhere that if I save it on NSDocumentDirectory, it would work, but I had no luck on trying that. I also tried NSMusicDirectory and NSLibraryDirectory. this is how I'm saving it: NSArray *documentPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *docDirectory = [documentPath objectAtIndex:0]; NSString *savePath = [docDirectory

Store and fetch documents in/from app documents folder

不羁岁月 提交于 2019-12-12 18:13:24
问题 Im writing a text editor app and im trying to store a NSString as NSData in files in the documents folder, for example i want to be able to store a file "myText.java". My code work on the Simulator. However, on the device a file seems to be created, but when I later try to load the data from the files i get nothing. Do i have to set some project setting to enable the documents directory on device or is my code wrong? Here is my store code: -(void) saveFile:(NSString*)file{ if (![file isEqual:

How to get partial file path after downloading with Alamofire?

a 夏天 提交于 2019-12-12 04:33:54
问题 I want to save the path of where I downloaded a file to my model object. Based on this StackOverflow answer, I should "only store the filename, and then combine it with the location of the documents directory on the fly". Well in my case it's the Application Support directory. I am not sure how to do this. The full path of where the file will be downloaded is: /Library/ApplicationSupport/com.Company.DemoApp/MainFolder/myFile.jpg /Library/Application Support/ is the part I can't save anywhere

Create a folder with Swift [duplicate]

為{幸葍}努か 提交于 2019-12-12 03:23:46
问题 This question already has answers here : Using NSFileManager and createDirectoryAtPath in Swift (4 answers) Closed 4 years ago . I'm trying to use NSFileManager 's method createDirectoryAtPath:withIntermediateDirectories:attributes:error: in Swift. The problem is that I have no idea what this function throws in case of error. Is this documented anywhere ? If yes, where? 回答1: When the Swift docs says a function throws , they mean that it throws an NSError . Consider the following do-try-catch

Documents folder working in Simulator but not iPad - Swift 2.1

我与影子孤独终老i 提交于 2019-12-12 02:45:14
问题 The below code unzips a folder of images into a folder I create. and then loops through it and adds the names to an array, then loops through this array and retrieves those file names into an array of images. It works perfectly on the simulator, but the data is empty when I do it on the iPad, it prints out nothing. I can only assume the folder isn't accessible or is being searched before the unzip has completed, but It shouldnt as I am using NSOperationQueue with a completion block. func

Unable to create directory under NSHomeDirectory

穿精又带淫゛_ 提交于 2019-12-12 02:29:57
问题 I have code which creates a folder under the NSHomeDirectory but it always fails and I cannot see why. It should work but it keeps saying the operation is not permitted. Any ideas? NSURL *homeURL = [NSURL fileURLWithPath:NSHomeDirectory() isDirectory:YES]; NSURL *previewsURL = [homeURL URLByAppendingPathComponent:@"Previews"]; DebugLog(@"homeURL: %@", homeURL); DebugLog(@"previewsURL: %@", previewsURL); BOOL isDirectory = TRUE; if (![[NSFileManager defaultManager] fileExistsAtPath:previewsURL