Post not yet marked as solved
I'm using the library KeychainAccess to save a token in the keychain. For some reason I'm getting an error when SecItemAdd is called, presenting a system dialogue saying "Keychain not found" "A keychain cannot be found to store "token." and a button to "Reset to Defaults" which shows another alert "Are you sure you want to reset your keychain? This will delete all your saved passwords, keys, and certificates. You cannot undo this operation."
The same code is working for many others on my team, and others using this library. I can't find much on this error. Is there a way to fix without reseting my personal keychain?
Post not yet marked as solved
I updated to the 12.3 beta the other day (by accident, I didn't realize or know how I ended up in the beta program for Mac), and I realized my Documents folder was empty. I thought perhaps it is a visual glitch and put another file in there, then rebooted, and that file is now missing too on reboot. Spotlight and Finder can't find any of the missing files so I believe they're being deleted on reboot now. Hope this is fixed soon.
Post not yet marked as solved
Some of the table views in my application are showing a focus effect when touching the screen. From my understanding and using Apple’s apps and samples, the focus effect should only appear when using the keyboard for navigation. I can’t figure out how to disable the focus effect for touches without disabling keyboard navigation entirely though.
I have another table view, that is set up in an almost identical way but with a different cell layout, but never shows a focus effect even with the keyboard, although I can see the table scroll as I press the arrow down key.
I haven’t started implementing any custom focus code yet. I just build the app with Xcode 13 and dropped support for iOS 13.
Any help is appreciated!
Post not yet marked as solved
I'm using fileImporter for a Mac app. If I open a file from iCloud Drive that isn't already downloaded, I need to start the download before I can read the contents of the file. I found that I can download the file by using NSFileCoordinator or FileManager.default.startDownloadingUbiquitousItem.
These APIs will begin the download, but I have no updates on the progress or if the file has been downloaded. I've tried to use NSMetadataQuery with no luck.
Is there a way, either with fileImporter in SwiftUI or an AppKit API that I can receive updates for when a remote file has been downloaded, or do I need to prompt the users to download the file themselves before importing into my app?
Post not yet marked as solved
Every time I refresh the page, the status goes from "hold" to "no payment method" and just keeps alternating. I do have payment info set and $100 credit, and search ads are live, and in the US. Why can I not enable my ads?
Post not yet marked as solved
I want to refresh my widget every day at midnight. I'm getting the date with
let currentDate = Date()
let midnight = Calendar.current.startOfDay(for: currentDate)
let nextMidnight = Calendar.current.date(byAdding: .day, value: 1, to: midnight)!
and passing it to my TimeLine
completion(Timeline(entries: entries, policy: .after(nextMidnight)))
but when I reach this date, my widget doesn't refresh. I've also received reports from Testflight users of my app that say they see a "-1 Day" label in my widget, which sounds like the view of the widget refreshed before fetching a new timeline with an entry for the next day.
I tested widget refresh from actually being up til after midnight, and by changing the clock on the phone to 11:5X and waiting, never seeing a change or code executed when attached to Xcode.
Post not yet marked as solved
I'd like to display the number of days til a date inside of a widget, such as "2 days", but when I get to 1 day I want to have it say "Tomorrow", and on the same date to display the time "8:00 PM". I'm currently doing this by getting the number of days between the current date and second date and switching on that number, and creating a new label with different strings. Because widgets don't update automatically I'll have to refresh my widget every day at midnight to have the label re-calculate.
Can I get this same functionality with existing formatters, or subclass DateFormatter myself and have the label refresh periodically as when using Text(date, style: ...)?
I did try subclassing DateFormatter and override string(from:) → String but the text doesn't appear.
Post not yet marked as solved
My app uses CoreData to locally cache data from other services (3rd party, CloudKit). To simplify the logic of when I send changes from the app back to the service I use a notification listening for `NSManagedObjectContextDidSave`.```NotificationCenter.default.addObserver(forName: .NSManagedObjectContextDidSave, object: nil, queue: nil) { [weak self] notification in guard let welf = self, let userInfo = notification.userInfo, let context = notification.object as? NSManagedObjectContext, context.parent == nil else { return } if let shouldSync = context.userInfo["ShouldSync"] as? Bool, !shouldSync { return } let syncContext = welf.coreDataStack.newPrivateContext() syncContext.name = "SyncContext" syncContext.perform { syncContext.userInfo["ShouldSync"] = false let inserted = welf.objectsForKey(NSInsertedObjectsKey, dictionary: userInfo as NSDictionary, context: syncContext) let updated = welf.objectsForKey(NSUpdatedObjectsKey, dictionary: userInfo as NSDictionary, context: syncContext) let deleted = welf.objectsForKey(NSDeletedObjectsKey, dictionary: userInfo as NSDictionary, context: syncContext) welf.syncManager.store(inserted, updated: updated, deleted: deleted, context: syncContext) } }```I use `ShouldSync` user info to easily ignore trying to save the changes made by `syncManager.store` which flip flags on objects to mark them as up to date or not.```public func newPrivateContext() -> NSManagedObjectContext { let newPrivateContext = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType) newPrivateContext.persistentStoreCoordinator = storeContainer.persistentStoreCoordinator newPrivateContext.name = "New private context" newPrivateContext.mergePolicy = NSMergePolicy(merge: .mergeByPropertyObjectTrumpMergePolicyType) return newPrivateContext }```This is the new context I create, simply so I can add the `ShouldSync` user info without changing the context I use throughout the app and UI.Anyways, I'm seeing some weird behavior where I flip the sync flag `object.hasSynced = false` to start syncing and when I check the `userInfo` and the contexts `registeredObjects` in `NSManagedObjectContextDidSave` notification block I see `hasSynced = true`.How can I debug / fix this? The only method that sets `hasSynced` to true is creating the objects from the server, and within `syncManager.store(...)` so I don't think this is a problem of setting it to false and then back to true.
Post not yet marked as solved
Whenever a build fails I always filter out the warnings to show just the errors, I would like to automate this action though. I looked into Xcode behaviors and I can change the navigator to the warnings screen but I'm not seeing a option to apply that filter. Is there a way I can add this functionality or will I need to file a request with Apple?
Post not yet marked as solved
So when the first beta arrived, I wanted to check out the new features, same as everyone. I installed on my device and everything seemed fine. Then beta 2 arrived, and I installed the OTA profile and tried to get beta 2, but It never showed up. It was pretty new so I thought I'd have to wait. As my main work does not develop for beta iOS, I forgot about it until the latest beta, and the phone still couldn't find any OTAs available. I then went to restore the phone to beta 5 instead. To restore I had to turn off Find My iPhone, but that also wouldn't connect to the server, so I put my phone into DFU mode and restored from that, hoping beta 5 would fix the connection issues, but it didn't, and I couldn't activate my phone even then. I'm in the process of restoring back to iOS 12.4, hoping a normal release can fix this, and then back to beta 5. I searched the forums and haven't seen anything in iOS 13 beta but I have found similar posts for iOS 11, 10, and 9. I didn't see any answers or success stories though. Is my phone now useless?Edit:Downgraded to iOS 12, but It cannot log into my iTunes account. I enter my Apple Id email and a spinner appears and loads forever. Guess I've learned never to install beta software.
Post not yet marked as solved
So I'm running into a really odd visual glitch where my cells contentView doesn't change after performing the action of a swipe for `editActionsForRowAt`. It does work the first time, and every other time after though. I believe this issue is caused by NSFetchedResultsController, but also specific to my single app. I can replicate this issue in 3 different table controllers, with custom cells and a plain UITableViewCell only setting the textLabel property. I've tried disabling as much code as possible but can still reproduce. I converted one of the views to not use NSFetchedResultsController and to just perform it's own fetches but it didn't reproduce even with custom cells on there. I created a new project and implemented NSFetchedResultsController and wasn't able to reproduce. I'm not sure how else to fix at this point. Here's a link to a tweet with picture of the visual bug. https://twitter.com/maxhasadhd/status/1153112418316431365
Post not yet marked as solved
I have a view controller I present with a navigation controller, and its main content changes based on the data the app has. So if theres no data, I display an empty state screen, if there is data I display a table controller. The empty state and table view are both separate controllers and I add them as children when needed. This seems to not work well with iOS 11s large titles and search controllers to hide them on scrolling. I can't find any information about it either.Here's my navigation item / bar setupnavigationItem.largeTitleDisplayMode = .automatic
navigationController?.navigationBar.prefersLargeTitles = true
navigationItem.title = NSLocalizedString("LISTS_TITLE", comment: "Lists")
navigationItem.hidesSearchBarWhenScrolling = trueand this is my code for adding / removing child controllersprivate func setContentViewController(_ viewController: UIViewController) {
for child in childViewControllers {
child.willMove(toParentViewController: nil)
child.view.removeFromSuperview()
child.removeFromParentViewController()
}
addChildViewController(viewController)
let contentView = viewController.view!
contentView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(contentView)
view.bringSubview(toFront: contentView)
viewController.didMove(toParentViewController: self)
/
var constraints = [NSLayoutConstraint]()
constraints.append(contentView.leadingAnchor.constraint(equalTo: view.leadingAnchor))
constraints.append(contentView.trailingAnchor.constraint(equalTo: view.trailingAnchor))
constraints.append(contentView.topAnchor.constraint(equalTo: view.topAnchor))
constraints.append(contentView.bottomAnchor.constraint(equalTo: view.bottomAnchor))
view.addConstraints(constraints)
}If anyone has seen this as well, I'd apprechiate the help.
Post not yet marked as solved
Since Xcode 9 betas, one of my projects continually forgets which folders are open / closed, and goes back to the same folders opened as before. I'm not sure any other fix besides creating a new project and moving everything into that one instead. Is there a easier fix?
Post not yet marked as solved
Xcode is continuously reseting which folders have opened by some trigger (I think its building the project), so the same folders keep opening when I look, instead of how I last left it. Has anyone else eperienced this? What could a fix be?
Post not yet marked as solved
Is there a single way of disabling smart invert for an entire app? My application already has dark UI.