Search results for

NSCocoaErrorDomain

1,063 results found

Post

Replies

Boosts

Views

Activity

Reply to menu bar popover doesn't display when in fullscreen
Thanks pointing me in the right direction. The example you have provided does not work for me, however. In my attempts, entering any question, or even just yes or no in the Demo box results in:>>> noFailed to query oracle: Error Domain=NSCocoaErrorDomain Code=4099 The connection to service named XYZABC1234.com.example.iDecideHelper was invalidated. UserInfo={NSDebugDescription=The connection to service named XYZABC1234.com.example.iDecideHelper was invalidated.}
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’17
Reply to menu bar popover doesn't display when in fullscreen
Failed to query oracle: Error Domain=NSCocoaErrorDomain Code=4099 The connection to service named XYZABC1234.com.example.iDecideHelper was invalidated. …Note that the message above contains a dummy Team ID, XYZABC1234. You’ll have to change that to your Team ID. The sample’s read me explains how to do this.I literally did this yesterday while helping a developer as part of my Real Job™ (answering DTS tech support incidents). As part of that I wrote up some notes on the common gotchas here. They’re pasted in below.Share and Enjoy — Quinn “The Eskimo!” Apple Developer Relations, Developer Technical Support, Core OS/Hardware let myEmail = eskimo + 1 + @apple.comHere’s some hints on how to bring up an XPC login item:Start by getting the AppSandboxLoginItemXPCDemo sample working. This will yield vital experience in getting the details right, and a known baseline by which to measure your ongoing work.Add a “Disable” menu command to AppSandboxLoginItemXPCDemo that calls SMLoginItemSetEnabled(…, false). This
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’17
Test if PDF exists at URL always returns error
The NSURL method checkResourceIsReachableAndReturnError always returns the following error::'Domain=NSCocoaErrorDomain Code=262 The file couldn’t be opened because the specified URL type isn’t supported.'The code: NSError * error = nil; NSURL * baseURL = [NSURL URLWithString:@http://www.adomainname.com NSString * newsletterFileName = [NSString stringWithFormat: @uploads/%4ld_%02ld_-_org_newsletter.pdf , newsLetterYear // defined as current year , newsLetterMonth]; // defined as current month // should end up as: http://www.adomainname.com/uploads/YYYY_MM_-_org_newsletter.pdf NSURL * resourceURL2= [NSURL fileURLWithPath: newsletterFileName relativeToURL: baseURL]; if ( ! [resourceURL2 checkResourceIsReachableAndReturnError: &error] ) { if ( nil != error ) { NSLog ( @%@, [error localizedDescription] ); --newsLetterMonth; } } _newsletterMaximumMonth = newsLetterMonth;Line 8 always returns NO even though the following two lines will load the file and display it: NSURLRequest *request = [NSURLRequest
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
845
Sep ’17
Reply to Swift 4 Rest API oauth v1.0 and base signature
Thank you for your reply! My apologies on the formatting. I will correct that moving forward.import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() / let url = URL(string: https:/ let task = URLSession.shared.dataTask(with: url) { (data, response, error) in if let error = error { print(error) return } guard let urlContent = data else { print(`data` is nil) return } do { let jsonResult = try JSONSerialization.jsonObject(with: urlContent) print(jsonResult) } catch { print(error) } } task.resume() } }I ran this code and it produce the following message in the console:Error Domain=NSCocoaErrorDomain Code=3840 JSON text did not start with array or object and option to allow fragments not set. UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}Yesterday, I spent about 9 hours (saddens me to even call it out in a number), trying to run different syntax to connect to the server. The closest I got wa
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’17
Reply to Swift 4 Rest API oauth v1.0 and base signature
It looks like it is due to missing oauth parameters. I am also missing the rest of the signature as well. Here is the error message for the reference:<?xml version=1.0 encoding=utf-8 ?><error xmlns=http:/ <code>2</code> <message>Missing required oauth parameter: oauth_signature_method</message></error>Error Domain=NSCocoaErrorDomain Code=3840 JSON text did not start with array or object and option to allow fragments not set. UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}My signature base string would need to include the following information:HTTP MethodWe support both HTTP methods GET and POST.Request URLThe URL to make API calls is: platform . fatsecret . com / rest / server . apiNormalized ParametersPlease refer to the FatSecret REST API documentation for the full parameter list for each method, but for OAuth authentication the following parameters are required for every request:oauth_consumer_
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’17
NSPersistentContainer "Attempted to perform an operation without an open database"
I have been using NSPersistentContainer in my app and while, for the most part it works great, a growing percentage of my users are encountering crashes due to what looks like a database connection error when calling `performFetch()` on an `NSFetchedResultsController`.fatal error: 'try!' expression unexpectedly raised an error: Error Domain=NSCocoaErrorDomain Code=134060 A Core Data error occurred. UserInfo={NSFilePath=/var/mobile/Containers/Data/Application/1AD99C00-B61F-4BA5-B832-81DB8C486030/Library/Application Support/<redacted>.sqlite, NSUnderlyingException=Attempted to perform an operation without an open database}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-802.0.53/src/swift/stdlib/public/core/ErrorType.swift, line 182From what I can piece together from crash reports, it happens:* Always after `container.loadPersistentStores` calls back successfully* On both the `viewContext` and contexts generated by `newBackgroundContext()`* Immediately on launch (though the app fe
1
0
1.4k
Sep ’17
Providing a file with FileProviderExtension
I am building a FileProviderExtension in Swift for my app. So far, I am able to enumerate files from a server, and attach thumbnails and metadata to display them in the browse tab of the Files app.I would like to know what I need to do to have my FileProvider call startProvidingItem , so that the Files app can open my file in another application. override func urlForItem(withPersistentIdentifier identifier: NSFileProviderItemIdentifier) -> URL? { guard let item = try? item(for: identifier) else { return nil } let manager = NSFileProviderManager.default let perItemDirectory = manager.documentStorageURL.appendingPathComponent(identifier.rawValue, isDirectory: true) return perItemDirectory.appendingPathComponent(item.filename, isDirectory:false) } override func providePlaceholder(at url: URL, completionHandler: @escaping (Error?) -> Void) { guard let identifier = persistentIdentifierForItem(at: url) else { completionHandler(NSFileProviderError(.noSuchItem)) return } do { let fileProviderItem = try? item(fo
2
0
2.6k
Sep ’17
Manual Migration Example or help with mine
Hi,I tried to automatically migrate my database, I didn't get any errors, however all the existing Entitiy rows are missing after automatic migration.So I tried manual migration without much luck.Does anyone have a full example of a manual migration using NSMigrationManager.migrateStore?The only example I have found so fat is the objc.io one, but it doesn't use migrateStore.I am following the Core Data Programming Guide but the parameters are not really specified in their examples.I am having issues working out how to specify some of the parameters, particularly around what the sourceModel and destinationModel should actually point to.sourceVersion = 2.5.2 (My App Store Core Data Version)destinationVersion = 2.5.3 (Development version with lots of changes)sourceModelUrl = file:///Users/MyName/Library/Developer/CoreSimulator/Devices/38B3746B-9BDF-4641-9783-4FAAE00DA369/data/Containers/Bundle/Application/D94FAD26-A12D-4486-8E67-618778B7A80E/XXXXXX.app/APDataModel.momd/APDataModel%202.5.2.momdestinationModelUrl
1
0
760
Sep ’17
File rename failing NSCocoaErrorDomain Code=513
I'm trying to rename a file (a FileWrapper containing a UIDocument subclass) as follows:coordinationQueue.async { var error: NSError? = nil let fileCoordinator = NSFileCoordinator(filePresenter: self) fileCoordinator.coordinate(readingItemAt: url, options: .withoutChanges, writingItemAt: targetURL, options: .forMoving, error: &error) { fromURL, toURL in do { fileCoordinator.item(at: fromURL, willMoveTo: toURL) try FileManager().moveItem(at: fromURL, to: toURL) fileCoordinator.item(at: fromURL, didMoveTo: toURL) // Success! } catch { // Handle error } } if let error = error { // Handle error } }… but it's failing on the moveItem, with the following error:Error Domain=NSCocoaErrorDomain Code=513 “from_file” couldn’t be moved because you don’t have permission to access “My_folder”. UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/My_folder/from_file, NSUserStringVariant=( Move), NSDestinationFilePath=/private/var/mobile/Library/Mobile Documents/com~
0
0
5.4k
Sep ’17
Can't read binary data from file
My app compiled with Xcode 9.0 on macOS 10.13 fails to open CoreData binary files with this error:NSUnderlyingError = Error Domain=NSCocoaErrorDomain Code=259 The file U201cK1GQ General Log.sl-binaryU201d couldnU2019t be opened because it isnU2019t in the correct format. UserInfo={NSFilePath=/Users/wlmyers/Documents/Ham Radio/K1GQ Station/Logs/K1GQ/K1GQ General Log.sl-binary, NSUnderlyingException=value for key 'NS.objects' was of unexpected class 'Exchange'. Allowed classes are '{(n NSDictionary,n NSDictionaryMapNode,n NSArray,n NSString,n NSNumber,n NSOrderedSet,n NSCalendarDate,n NSDate,n NSSet,n NSDecimalNumber,n NSUUID,n NSNull,n NSURL,n NSDatan)}'.}The Exchange class is of type Transformable. The file itself opens on the same macOS 10.13 machine without issues, using the same app compiled previously on macOS 10.12.Has anyone a clue how to make Exchange an allowed class?
7
0
4.5k
Sep ’17
Renaming a UIDocument in iCloud
I'm struggling to figure out how to rename an instance of a UIDocument subclass in an iCloud folder. I've tried saving the document with the new URL…func renameDocument(to name: String) { let targetURL = document.fileURL.deletingLastPathComponent().appendingPathComponent(name) .appendingPathExtension(<extension>) document.save(to: targetURL, for: .forCreating) { success in guard success else { // This always fails return } // Success } }…but this fails with…Error Domain=NSCocoaErrorDomain Code=513 “<new-file-name>” couldn’t be moved because you don’t have permission to access “<folder>”. UserInfo={NSSourceFilePathErrorKey=/private/var/mobile/Containers/Data/Application/1A9ACC2B-81EF-4EC9-940E-1C129BDB1914/tmp/(A Document Being Saved By My App)/<new-file-name>, NSUserStringVariant=( Move ), NSDestinationFilePath=/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/<folder>/<new-file-name>, NSFilePath=/private/var/mobile/Containers/Data/Application/1A9ACC
Topic: UI Frameworks SubTopic: UIKit Tags:
6
0
6.9k
Oct ’17
Any File Provider built with Xcode 9 cannot launch on iOS 9 and 10
This article mentions Supporting iOS 10 and Earlierhttps://developer.apple.com/documentation/fileprovider/creating_file_providers_for_multiple_versions_of_iosThe required iOS 9/10 compatibility code works fine on any iOS when the app is built with Xcode 8.However with Xcode 9, the same code doesn't work on iOS 9 and 10, but does work on iOS 11.iOS 9 & 10 device log errors:Oct 3 17:14:43 ioss-iPad fileproviderd(Foundation)[21] <Notice>: calling plugIn beginUsing:Oct 3 17:14:43 ioss-iPad fileproviderd(PlugInKit)[21] <Error>: plug-in <private> pre-screen sees activating stateOct 3 17:14:43 ioss-iPad fileproviderd(PlugInKit)[21] <Notice>: connection to plug-in <private>(BBD75744-289E-41E9-A701-28B70E4DCD15) lostOct 3 17:14:43 ioss-iPad fileproviderd(PlugInKit)[21] <Error>: Hub connection error Error Domain=NSCocoaErrorDomain Code=4097 connection to service named company.TestProvider.DocumentProviderFileProvider UserInfo={NSDebugDescription=connection to service nam
2
0
894
Oct ’17
Xcode 9 only: tvOS permission denied to create directory under "Library"
When I upgraded from Xcode 8 to 9, existing code that creates a directory started to fail. This code fails on Xcode 9 on a tvOS device. It runs fine in the simulator, and in Xcode 8 it runs fine in the simulator and on a device.It's easy to repro. Create a new tvOS project with Xcode 9 with the following app delegate:@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { var url = FileManager.default.urls(for: .libraryDirectory, in: .userDomainMask)[0] url = url.appendingPathComponent(Testing123, isDirectory: true) print(URL = (url)) print(Exists = (fileExists(url: url))) do { try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true, attributes: nil) } catch { assertionFailure(Could not create (url): (error)) } return true } private func fileExists(url: URL) -> Bool { return (try? url.checkResource
14
0
5.6k
Oct ’17
How create CKAsset ?
In Xcode 8i set CKAsset with code:let URLinage:URL = URL.init(fileURLWithPath: NSTemporaryDirectory()).appendingPathExtension(png) do { try dataImage.write(to: URLinage) } catch let error as NSError { print((error.debugDescription)) } let assetImage:CKAsset = CKAsset(fileURL: URLinage)Now in Xcode 9 , return error :Error Domain=NSCocoaErrorDomain Code=513 You don’t have permission to save the file “tmp.png” in the folder “90006228-F2E5-44DC-A69C-AB673F679CA8”. UserInfo={NSFilePath=/private/var/mobile/Containers/Data/Application/90006228-F2E5-44DC-A69C-AB673F679CA8/tmp.png, NSUnderlyingError=0x1c0c51100 {Error Domain=NSPOSIXErrorDomain Code=1 Operation not permitted}}How resolve error ???
2
0
620
Oct ’17
Reply to keyboard freezing in simulator
Thanks Jeremy.My machine won't run Xcode later than 8.2.1. But it's easy for me to give you logs from 8.2.1. Here's one from an app that I got just now:2017-10-23 17:29:48.848 TGAMobile[52042:5848428] -[UIKeyboardInputManagerClient handleError:forRequest:] will retry sending handleKeyboardInput:keyboardState:completionHandler: to keyboard daemon after receiving Error Domain=NSCocoaErrorDomain Code=4097 connection to service named com.apple.TextInput UserInfo={NSDebugDescription=connection to service named com.apple.TextInput} 2017-10-23 17:30:09.452 TGAMobile[52042:5848428] -[UIKeyboardInputManagerClient handleError:forRequest:] will retry sending handleKeyboardInput:keyboardState:completionHandler: to keyboard daemon after receiving Error Domain=NSCocoaErrorDomain Code=4097 connection to service named com.apple.TextInput UserInfo={NSDebugDescription=connection to service named com.apple.TextInput}The kbd log isProcess: kbd [52201] Path: /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS
Oct ’17