Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
44 views

Supporting Custom Files with "/" Characters in Swift

My app has a custom file type, and I'm trying to update my code so that when I export or import a file that has a "/" character in the name. Currently the app just fails to export a file ...
narner's user avatar
  • 3,161
-1 votes
1 answer
31 views

Not sure why Swift's fileExists fails on checking existence of a file which I can see in the directory

Part of my app creates files, and then a timer batches them. My problem is that using the fileExists method my app insists that the searched for app does not exist. I see the files in the Files app, ...
Bartender1382's user avatar
0 votes
0 answers
51 views

ios18 send netwrork [NSFileManager createDirectoryAtURL:withIntermediateDirectories:attributes:error:]: URL is nil'

When I initiate the following request in the app delegate, it is good in iOS 17, but it will crash in iOS 18. The code is as below: NSString *url = @"https://www.baidu.com"; NSString * restr ...
user26674321's user avatar
1 vote
1 answer
69 views

Swift FileManager.default.copyItem(at: URL, to: URL) folder permission error

I'm writing a small Mac OS X Desktop application that copies a random sampling of files from a source folder to a destination folder, see Select-Random-Files. The code that's giving me the most ...
belovachap's user avatar
0 votes
0 answers
37 views

ContentsOfDirectory for FileProvider URLs

I'm developing an iOS app. Through a .fileImporter I get access to a directory URL which might be provided by an external service like Dropbox (using a FileProvider). As the user picked the URL I have ...
Dominik's user avatar
  • 756
0 votes
1 answer
148 views

swiftui photopicker video is not accessible after rerunning the application

I'm trying to pick a video with photo picker this way: @State var selectedItem: PhotosPickerItem? = nil @State var showPhotoPicker = false With those 2 states i'm showing the picker: ....
Udi Oshi's user avatar
  • 6,867
3 votes
0 answers
183 views

When .fileImporter is presented the Xcode console shows: "Unknown client: App Name"

I am writing my first SwiftUI app that uses the FileManager (via .fileImporter) to read data from a saved text (.csv) file. Although everything seems to be working OK, the Xcode console displays the ...
HirsuteJim's user avatar
2 votes
1 answer
199 views

Zip files of a Directory without any root folder

I want to zip files inside a folder in my iOS application written in the Swift language. I am using ZipFoundation CocoaPod of version 0.9.5. let fileManager = FileManager.default guard let sourceURL ...
Vivek's user avatar
  • 90
0 votes
0 answers
37 views

Downloading from iCloud, files truncated, fine from other sources

I'm using this code which is a mildly doctored version of an online tutorial. I understand the parts, but when I run it, the downloads happen, I get an error-free completion message. But the resulting ...
Dan Donaldson's user avatar
0 votes
1 answer
184 views

iOS: how to determine if a file is a bundle resource (included in IPA)

I'm building a framework, and need to differentiate between a file that is a bundle resource (included in the App Store IPA / static file defined at development time) and a file that the app creates (...
scosman's user avatar
  • 2,505
0 votes
3 answers
177 views

When we try to export CapturedRoom getting cannotCreateNode(path: "/9EE71ED0F8D6415496A7B9F0C3671DB0321") in

We are using the RoomPlan API to capture data, which is stored in the 'CapturedRoom' variable in our code (referred to as 'finalResult'). We then attempt to save a USDZ file in the file manager. ...
shiv's user avatar
  • 39
0 votes
2 answers
90 views

How to create model in Swift?

I am a beginner in the Swift language. I have multiple arrays in one view controller from which I am loading data in the tableview. My code is: let filemanager = FileManager.default var ...
Abhishek kumar's user avatar
0 votes
0 answers
68 views

What does SearchPathDomainMask mean in Swift?

In swift, we use Filemanager.default.url(for:in:) to get user directories or system directories. And we pass arguments typed SearchPathDirectory and SearchPathDomainMask to specify what urls we need. ...
ST K's user avatar
  • 139
1 vote
0 answers
50 views

How to create a temporary file container, file system, or custom file stream for intercepting clipboard access to temporary files on macOS?

I'm developing a cross-platform clipboard sharing software and currently working on implementing file copying functionality. On Windows, I can achieve file copy by creating an IDataObject and IStream, ...
gao.xiangyang's user avatar
0 votes
1 answer
202 views

I cannot access a file I have just saved to my documents directory

Here is my saving and retrieving code: func retrieveSong(songId: String) -> URL? { guard let pathComponent = cache[songId] else { return nil } if let ...
Halpo's user avatar
  • 3,084
0 votes
0 answers
100 views

How to save data in document directory without replacing previous one

I am new in swift macos development, I am using this code but it is used to replace previous one but i want not to replace, I want to add new and also want to contain previous thanks in advance let ...
Muhammad Taha's user avatar
-1 votes
1 answer
315 views

Swift relativePath property that FileManager.default.enumerator outputs is full path

I want to get relative paths, but I get full paths in the following code. Xcode 14.3 let homePath = NSHomeDirectory() let homeURL = URL(fileURLWithPath: ".", relativeTo: URL(...
Takakiri's user avatar
0 votes
0 answers
184 views

Copy image to temp folder but failed to read

I have issue on copy image to a temp folder then read out from this. I can copy the image to the temporary folder ( with no error thrown). I trying to read out the item list in folder. The error i ...
WCY's user avatar
  • 33
0 votes
0 answers
389 views

Swift's FileManager.default.url not creating files, keeps throwing errors

I've written these two function func locallySave(_ data: Data?, for utility: Utility) throws { var fileURL = try FileManager.default.url(for: .applicationSupportDirectory, ...
Tiny Tim's user avatar
  • 275
0 votes
1 answer
162 views

Permission error when saving to documentDirectory

I am trying to save favourites to document directory, the code works fine when I run it in simulator however when I build it to my device I am getting the following error. You don’t have permission ...
James Gifford's user avatar
0 votes
0 answers
30 views

iOS file system directory data not persisting between builds, will it persist between App Store updates? [duplicate]

I am saving a movie file in an iOS documents directory. The file is saved fine and I can access and play it after it has been saved. But when I rebuild the project I can't access the file, when I ...
Badger's user avatar
  • 31
0 votes
1 answer
57 views

Text file can't be created inside a folder

I'm trying to create a log.txt file inside a folder of a device, but I get this error: NSCocoaErrorDomain Code=512 "The file “log.txt” couldn’t be saved in the folder “Logs”. The folder Logs ...
Steven-Carrot's user avatar
1 vote
1 answer
87 views

URLResourceValues not working for renaming a file

I have to rename some files in a directory in the Documents directory. I'm trying with URLResourceValues: let fileURLs = try! FileManager.default.contentsOfDirectory(at: directory, ...
Murray Sagal's user avatar
  • 8,604
-1 votes
1 answer
28 views

Has the behavior of copyItemAtPath changed under Ventura? Returning "file doesn't exist"

My app creates a working file in the Application Support folder at launch, and subsequently saves that file in a user preferred folder (specified in preferences as a path). The save code is very ...
johnpurlia's user avatar
0 votes
1 answer
607 views

How to download PDF using URL in iOS app multiple times

I am getting getting multiple PDF urls from server response and showing them in tableview with download option for each cell. I am able to download each pdf file only once, But, Tried to second time ...
Anilkumar iOS Developer's user avatar
0 votes
1 answer
180 views

cannot access app group folder in intent handler

I have the following code in an intent handler for a widget I am creating: extension FileManager { static var appGroupURLAsText: String { `default`.containerURL(forSecurityApplicationGroupIdentifier:...
Philip7899's user avatar
  • 4,667
-1 votes
1 answer
198 views

How do i save video to new directory in ios?

I'm working with filemanager. So far I'm able to initialize my directory but when I try to save data there, the error i get is "error: Cannot create file".There seems to be an issue with the ...
codechef's user avatar
-1 votes
1 answer
799 views

How to download CSV file from the web with dowload URL Swift

So I need to get the data from a google sheet (which I'm trying to generate the link for, not sure), but I have a dummy link which works. I wrote this code to download the CSV file from the ...
Nexteon's user avatar
  • 33
1 vote
1 answer
349 views

Creating a temporary txt file, from a String, to use as an NSSharingService item?

When the user is confronted with an unexpected error, I'm providing them with the option to send the error log contents as an email body of an NSSharingService item as such: let errorLog = "[...
JDev's user avatar
  • 5,508
0 votes
0 answers
198 views

Am i doubling the amount of time it takes for the video to upload (from user's camera roll)?

In one of my view controllers, I'm using PHPickerViewController. When I get my results, I then upload the URL to Firebase. It works fine, but with this line of code, try! FileManager.default.copyItem(...
EAO123's user avatar
  • 67
0 votes
0 answers
83 views

Iterate through local Swift packages

I have a bunch of local Swift packages in my project. Some of them are third party, but I have made some modifications to them to suit my needs. I want to display them in a list of acknowledgements in ...
Crazed'n'Dazed's user avatar
1 vote
1 answer
306 views

Persisting with FileManager is producing unique urls at every app launch in Simulator

I want to persist data, images and otherwise. I read that saving to files is especially recommended for larger data. I followed relevant parts of this tutorial: https://developer.apple.com/tutorials/...
ScottyBlades's user avatar
  • 13.7k
0 votes
1 answer
133 views

How to access user selected folder in iOS

I'm looking for an iOS API that allows accessing a user-selected folder in place (without importing it). It seems to be possible with native frameworks from Apple. How I expect it to work: User ...
Darrarski's user avatar
  • 3,992
-1 votes
2 answers
4k views

Different path URL for FileManager everytime I open the app [duplicate]

I want to create one folder in the fileManager root path, but before creating it, I want to check that the folder exist or not, and if not, I will create, otherwise will leave it here are the function ...
martin wotterman's user avatar
3 votes
1 answer
467 views

Why is my Swift app created text file visible/accessible in the simulator, but not the iOS device itself?

I would like my Swift app to be able to write a file (myDebug.log) that is viewable by a user on their iOS device. The code I am using is below. While the code can be cleaner and more efficient, right ...
Bartender1382's user avatar
0 votes
0 answers
240 views

NSFileManager moveItemAtPath does not work

I am using https://www.tutorialspoint.com/objective_c/objective_c_file_handling.htm as a reference to move a file to another directory but it is not working. There is no error. I added the code to see ...
eh1412's user avatar
  • 53
-1 votes
1 answer
138 views

While loop with NSFileManager directory enumerator not running

I am seeking help to understand why a tutorial I am following is not working for me. I am running macOS 12.3.1, Xcode 13.3.1. The project is in Objective-C and using XIB. This is a view-based ...
NotationMaster's user avatar
0 votes
1 answer
2k views

Swift: FileManager().fileExists(atPath: (fileURL.path)) without knowing extension

) today I have a problem and I can't find an easy solution. With: FileManager().fileExists(atPath:(fileURL.path)) it's simple to find out if a file exist. Actually I have the file name but don't know ...
Michael's user avatar
  • 696
0 votes
1 answer
69 views

how to get the rest of path from sub folder

I have a path like : file:///private/var/mobile/Containers/Data/Application/80C93A3C-DFB5-4756-8DC8-7ED34469EA11/Documents/allFiles/81B5D904-CCEC-4B92-BD9B-4175BF6A99BC.jpeg The thing that I am ...
Steven's user avatar
  • 772
1 vote
0 answers
356 views

How do I get the number of bytes written during a copy/move process using FileManager?

I want to show a progress indicator when conducting FileManager tasks such as moveItem and/or copyItem calls. Can Progress be used to monitor FileManager's progress? If so, can someone give me some ...
SouthernYankee65's user avatar
0 votes
0 answers
25 views

Swift photo loaded from file rotated 90 degrees [duplicate]

I'm taking UIImages and sending them over iOS' Multipeer framework. Here's the steps I take to do so: /// Save images to filesystem before sending over Multipeer func save(image: UIImage) -> ...
Mark's user avatar
  • 7,389
1 vote
0 answers
19 views

Case Sensitive FileManager.default.fileExists(atPath:) [duplicate]

When I on my Mac run FileManager.default.fileExists(atPath: path) the resulting check is case-insensitive. So filePath will return the same as FiLePaTh. I need it to do a case-sensitive check however....
Hans's user avatar
  • 2,472
1 vote
1 answer
374 views

renderer.writePDF doesn't work without error

I learn swift and faced with problem: when i try write pdf file in document directory nothing happened. Code: func createPDF() { // MARK: - create path let documentDir = FileManager....
Alexey Tsutsoev's user avatar
1 vote
0 answers
120 views

How to ignore cache when repeatedly reading from disk

I am writing an app that contains a small benchmark for I/O operations. For write operations, I am using a 'FileHandle' which works pretty well. I am testing my old USB stick and my calculation ...
inexcitus's user avatar
  • 2,609
0 votes
1 answer
264 views

When is ubiquitous container deleted?

I'm playing with iCloud Drive Documents/ubiquitous containers to share documents between devices my app is installed on. So far, everything seems to work fine. I can manage documents, get notified ...
Thorsten Dittmar's user avatar
0 votes
0 answers
833 views

Tracing file creation via dynamic analysis of iOS application (using Frida)

Using FRIDA (http://frida.re), I'm debugging/reverse engineering an iOS app. The aim is to trace every file or folder created on the device by the app during runtime. So far I've tried running this ...
T-StoneLeif's user avatar
1 vote
1 answer
614 views

Sorting arrays of file attributes by their creation date in Swift

I have been using Swift's [enumerator(at:includingPropertiesForKeys:options:)]1 to find all files within a given base path and create arrays for different resource keys (file name, path, creation date,...
davwillev's user avatar
0 votes
2 answers
2k views

Get the name of file(s) within last directory and the full directory path using Swift

I am trying to obtain the name of a file (JSON format but saved without an extension) within the last directory of a given path. Each file is saved with its own unique subpath inside the app's data ...
davwillev's user avatar
1 vote
0 answers
1k views

Swift -Get/Save RelativePath for URL

I save some audio. The path to the url is "/Users/abc/Library/Developer/CoreSimulator/Devices/C6751406-604F-4AF4-8D3F-DA26E208632D/data/Containers/Data/Application/7255C72B-F194-49F6-A73D-...
Lance Samaria's user avatar
1 vote
1 answer
834 views

Unable to access Files, because there is no such file or directory

Good Day. I receive a message with an image URL. Whenever I receive the image URL I have to show it through local notification. Like this However, I use UNNotificationAttachment convenience init(...
Ankur Lahiry's user avatar
  • 2,307

1
2 3 4 5
30