Search results for

NSCocoaErrorDomain

1,063 results found

Post

Replies

Boosts

Views

Activity

iOS 17 beta "You don’t have permission to save the file" crash on device
Issue This issue is reproducible on iOS 17 beta 4 and iOS 17.0 (21A5303d) public beta. When try to create a folder using the FileManager API, the app crashes with the following stack trace. Thread 1: Fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=513 You don’t have permission to save the file “Samples” in the folder “…”. UserInfo={NSURL=file://…/Samples.app/, NSUnderlyingError=0x28100cf00 {Error Domain=NSPOSIXErrorDomain Code=1 Operation not permitted}} What is the user impact? Users will not be able to run the app on iOS 17 Steps to Reproduce Create a new project Add the following code import SwiftUI struct ContentView: View { var body: some View { Text(Hello, world!) .onAppear { _ = makeTemporaryDirectory() } } /// Creates a temporary directory. private func makeTemporaryDirectory() -> URL { try! FileManager.default.url( for: .itemReplacementDirectory, in: .userDomainMask, appropriateFor: Bundle.main.bundleURL, create: true ) } } Build and run t
5
0
3.7k
Aug ’23
Launching iOS app from iCloud Drive
My iOS app supports a document type and includes the appropriate UTI data. It can therefore open documents of a specific type from mail attachments, for instance. It works well.I am currently stumped, however: when I open a document from the iCloud Drive app (tap document, share button, Copy to <app>) my application gets launched but any attempts to copy the item from the provided URL fails with NSCocoaErrorDomain, error 257 (basically telling me I don't have the permissions to read the file). This issue is not present when my app is running in the background, however, and does not seem to occur when the app gets launched from a mail attachment (whether it's running ot not).I compared the URLs handed to my app and they are identical, whether the app was running or not.Here's the URL my app is handed: file:///private/var/mobile/Library/Mobile%20Documents/com~apple~CloudDocs/filename.extThe code I'm using is the following:// uniqueURL is a destination URL in my app's sandbox: // file:///var/mobil
Topic: UI Frameworks SubTopic: UIKit Tags:
11
0
96k
Aug ’23
Reply to How to activate NEPacketTunnelProvider?
While still working on write to file, I'm running into this issue now. Error Domain=NSCocoaErrorDomain Code=513 UserInfo={NSFilePath=, NSUnderlyingError=0x600000c782a0 {Error Domain=NSPOSIXErrorDomain Code=1}}. I read the thread https://developer.apple.com/forums/thread/63075 and added .noFileProtection to my write method call, but that didn't fix the issue. Since the network extension works as root to write to file and I want to write to /private/tmp/example.txt, why am I seeing this error?
Aug ’23
Reply to CoreData: warning: CoreData+CloudKit
I have the same problem and my app is being rejected by Apple. I could not replicate the crash but I get crash report. the only clue is the warning message in the console: CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(1093): : Successfully set up CloudKit integration for store (1F2E3F9B-9DD9-4D61-9DB9-ADD2A3DE9D8D): (URL: file:///var/mobile/Containers/Data/Application/AAF688C5-D8C2-4A5E-A87D-B6F04537A941/Library/Application%20Support/shared.sqlite) CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _enqueueRequest:]_block_invoke_2(990): Failed to enqueue request: 82E677A0-8E75-470A-A5CC-59BBC6C53D38 CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate finishedAutomatedRequestWithResult:](3372): Finished request ' 82E677A0-8E75-470A-A5CC-59BBC6C53D38' with result: storeIdentifier: 0811C705-3EB2-4C73-BC5B-B96B43E4F2E0 success: 0 madeChanges: 0 error: Error Domain=NSCocoaErrorDomain Code=134417 Request ' 82E677A
Aug ’23
Reply to Swift build tool plugin unable to write to pluginWorkDirectory using Xcode Cloud
We also see this issue, interestingly when Xcode cloud shows the call to run the generated script, the surrounding sandbox-exec does seem to say that writing to this directory should be allowed, yet it still fails: Swift/ErrorType.swift:200: Fatal error: Error raised at top level: Error Domain=NSCocoaErrorDomain Code=513 You don’t have permission to save the file “String+TransactionsAccessors.swift” in the folder “StringsGeneratorPlugin”. UserInfo={NSURL=file:///Volumes/workspace/DerivedData/SourcePackages/plugins/SampleApp.output/SampleApp/StringsGeneratorPlugin/String+TransactionsAccessors.swift, NSUserStringVariant=Folder, NSUnderlyingError=0x600003104330 {Error Domain=NSPOSIXErrorDomain Code=1 Operation not permitted}} then in the call to sandbox-exec /Volumes/workspace/DerivedData/Build/Intermediates.noindex/SampleApp.build/Debug-iphonesimulator/SampleApp.build/Script-7981050304838536995.sh: line 17: 12085 Illegal instruction: 4 /usr/bin/sandbox-exec -p (version 1) (deny default) (import system.
Aug ’23
Background Assets Failed to move manifestURL to APP group
After receiving manifestURL in extension, I try to move it to the shared directory of APP group, as follows: NSURL *url = [NSFileManager.defaultManager containerURLForSecurityApplicationGroupIdentifier:self.appGroupIdentifier]; NSURL *storageURL = [url URLByAppendingPathComponent:@YYBAResCache isDirectory:YES]; BOOL isDirectory; BOOL isExists = [NSFileManager.defaultManager fileExistsAtPath:storageURL.path isDirectory:&isDirectory]; NSError *error = nil; if (!isExists || !isDirectory) { [NSFileManager.defaultManager createDirectoryAtURL:storageURL withIntermediateDirectories:YES attributes:@{NSFilePosixPermissions: [NSNumber numberWithShort:0777]} error:&error]; } if (error){ NSLog(@Failed to create session storage directory:%@,error); } NSURL *localManifestURL = [sessionStorageURL URLByAppendingPathComponent:@manifest.json]; Next, move the file: NSError *error; [NSFileManager.defaultManager moveItemAtURL:manifestURL toURL:localManifestURL error:&error]; if (error) { NSLog(@BackgroundAssetsTest ex
1
0
934
Jul ’23
Reply to TTSPlugins doesn't exist in Xcode Version 15.0 beta 4 (15A5195m)
My message was clipped, here is initial error: Speech Error: Error Domain=NSCocoaErrorDomain Code=260 The folder “TTSPlugins” doesn’t exist. UserInfo={NSUserStringVariant=( Folder ), NSFilePath=/Library/Developer/CoreSimulator/Volumes/iOS_21A5277g/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.0.simruntime/Contents/Resources/RuntimeRoot/System/Library/TTSPlugins, NSUnderlyingError=0x600000c72fa0 {Error Domain=NSPOSIXErrorDomain Code=2 No such file or directory}}
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’23
Reply to Use WeatherKit in an Xcode playground?
Update: This code does not crash the app, and the error returned hints that I might have an access issue. I'm still wondering if this is even possible in a playground. As an aside, I have successfully used Apple's Flight Planner app that is offered as a WeatherKit demo. So my account seems to be authorized or whatever the word is. import UIKit import WeatherKit import CoreLocation let sanFrancisco = CLLocation(latitude: 37.7749, longitude: 122.4194) do { let weather = try await WeatherService().weather(for: sanFrancisco) } catch { print(error) } This produces the error: xpcConnectionFailed(Error Domain=NSCocoaErrorDomain Code=4097 connection to service named com.apple.weatherkit.authservice UserInfo={NSDebugDescription=connection to service named com.apple.weatherkit.authservice}) Playground execution failed: error: execution stopped with unexpected state. error: Execution was interrupted. The process has been left at the point where it was interrupted, use thread return -x to return to the state bef
Jul ’23
XPC service failing to launch from Mac app's framework
Hi! First time using XPC on a Mac app, and I'm stuck on a problem I can't understand. I have an app with multiple frameworks, and I'm adding an XPC service to one of the pre-existing frameworks. Right now the service is just the template that uppercases a string. I took all the necessary steps, I believe (adding the service as a target dependency, and copying it to the XPC Services folder). However, when I run it in Debug mode, I always get: Error Domain=NSCocoaErrorDomain Code=4099 The connection to service named was invalidated: failed at lookup with error 3 - No such process. I also tested on a different, pre-existing framework, and the same thing happens. Here's the weird parts: if I create a new framework and follow exactly the same steps, it works. I've compare the build settings between both frameworks and everything seems similar. And if I run in Release mode, the original service on the problematic framework also works! If I create a project with similar setup (app + framework with service
1
0
1.2k
Jul ’23
Reply to Runtime error when using StoreKit 2
I'm having the same problem and seeing that this question was posted 5 month ago doesn't induce hope to find a fix. The users where able to subscribe, later the app logs a com.apple.storekit [Default] Failed in XPC service while enumerating transactions for IterationType.current: Error Domain=NSCocoaErrorDomain Code=4097 connection to service named com.apple.storekitagent UserInfo={NSDebugDescription=connection to service named com.apple.storekitagent} and purchases are not available anymore. I read that if the user deletes a com.apple.storekitagent folder somewhere and restarts the Mac, it works again but that's not even a good temporary solution.
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’23
Cannot accept CKShare invitation
Hi, after sharing a NSManagedObject, I send the link that CloudKit creates on open it a different device. The function func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) is called but when I accept the invitation, CloudKit returns this error: userDidAcceptCloudKitShare(with:): Failed to accept share invitations: Error Domain=NSCocoaErrorDomain Code=134406 Request 'A8FAB7C2-CF35-44E0-A0B9-C359757C248F' was aborted because the mirroring delegate never successfully initialized due to error: }> UserInfo={NSLocalizedFailureReason=Request 'A8FAB7C2-CF35-44E0-A0B9-C359757C248F' was aborted because the mirroring delegate never successfully initialized due to error: }>} Code I use to share the object: UICloudSharingController { self.container.share([unsharedFolder], to: nil) { (objectIDs, share, container, error) in guard error == nil, let share else { Logger.iCloudShare((#function): Failed to share an object: (error!))) completion(sh
2
0
1.1k
Apr ’23
Not able to Read or Write to "/Contents/Resource" folder with Xcode 14.3.1
I have my macOS app, which I'm distributing outside the MAC App Store through Notarizing the App. When my end-user unzipped my App (which they downloaded from a shared URL path) and opened it, It crashed after the first time opening (by clicking on the Gatekeeper check popup: Chrome downloaded this file today at 11:10 AM. Apple checked it for malicious software and none was detected. ) In my macOS app (distributing outside the MAC App Store through Notarizing the app), though I removed AppSandbox capability, I am still not able to read/write to the Resource folder. Error ESPlus-2023-06-28-173050_ips.txt Error Domain=NSCocoaErrorDomain Code=513 You don’t have permission to save the file “SupportTextFiles” in the folder “Resources”. UserInfo={NSFilePath=/x.app/Contents/Resources/SupportTextFiles, NSUnderlyingError=0x6000030e3c00 {Error Domain=NSPOSIXErrorDomain Code=1 Operation not permitted}}
1
0
1.1k
Jun ’23
Saving Lists of URLs with Bookmark Data - MacOS
I have been having some issues saving URLs. I want to be able to save a list of URLs with their bookmark data so that the app can still access some folders after reboot. The folders are on the desktop. I have read and write access to the disk, as was set in the app sandbox settings (User Selected File). It works for as long as the app is open but as soon as I restart it the URLs seem to go invalid, or at least it says that I don't have permission to access the folder that is selected. I then have to clear the urls and re-select them. You can ignore the blacklist thing as I am not using it in the tests I am running. You can also ignore the sources_list and dest_list they are for the GUI. Here is how the user selects the file: func inputBrowseClicked(source_or_dest: String) { let inputPanel = NSOpenPanel() if source_or_dest == blacklist { inputPanel.canChooseFiles = true inputPanel.canChooseDirectories = false } else { inputPanel.canChooseFiles = false inputPanel.canChooseDirectories = true } let userChoice = i
4
0
1.2k
Jun ’23
How to prevent folder creation in macOS FileProviderExtension
I need to prevent folder-creation in certain scenarios. I know I can achieve that via NSFileProviderUserInteractions but that only works when folder creation attempt is done via Finder. If however, user tries to create a folder in Terminal via mkdir folder1 then createItem callback does get called. In createItem callback I tried two options: Option 1 func createItem(basedOn itemTemplate: NSFileProviderItem, fields: NSFileProviderItemFields, contents url: URL?, options: NSFileProviderCreateItemOptions = [], request: NSFileProviderRequest, completionHandler: @escaping (NSFileProviderItem?, NSFileProviderItemFields, Bool, Error?) -> Void) -> Progress { let progress = Progress(totalUnitCount: 1) if itemTemplate.parentItemIdentifier == .rootContainer || itemTemplate.contentType == .aliasFile || itemTemplate.contentType == .symbolicLink { print(Preventing item creation in root level) let entry = Entry( id: UUID().uuidString.lowercased(), type: itemTemplate.contentType == .folder ? Entry.Kind.folder : Entry.Ki
2
0
980
Jun ’23
Bakground Assets error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.backgroundassets.user"
Message failed: -[BAAgentClientProxy currentDownloadsWithCompletion:]_block_invoke error: Error Domain=NSCocoaErrorDomain Code=4097 connection to service named com.apple.backgroundassets.user UserInfo={NSDebugDescription=connection to service named com.apple.backgroundassets.user} The above error occurs when debugging Background Assets on iPhone。
1
0
1.1k
Jun ’23