For me this error occurs when unwinding from another view controller, returning to an existing table view controllerThe triggering line in my code is a tableView.reloadRows at the selectedIndexPath (which is an unwrapped tableView.indexPathForSelectedRow): tableView.reloadRows(at: [selectedIndexPath], with: .automatic)My guess is this code happens before the view has loaded and that seems to be what Xcode is warning about. Unfortunately commenting out the row isn't an option if you are unwinding after updating the value in an existing tableView row (which is an approach in several Apple Swift/iOS examples, including in Apple's Everyone Can Code series). After commenting out the reload in the unwind, I added a viewDidAppear with the following code and this seems to fix things: override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) if let selectedIndexPath = tableView.indexPathForSelectedRow { tableView.reloadRows(at: [selectedIndexPath], with: .automatic) } }I'd welcome comments on whether this is a sound approach, but for now, this seems to be working. Also also - is it something we really need to be worrying about? I'm sure lots of developers have learned to use the unwind approach from Apple's examples, only to see that there are now warnings. Is this overzealousness in Xcode that we can plan on being fixed, or an appropriate warning that Apple-shared examples no longer work & an alternative should be found? Looking forward to an answer, as the above technique (that now earns an Xcode warning) is what I've been sharing with my students. Thanks! John
Post
Replies
Boosts
Views
Activity
I also encountered an issue with an unexpected:
No factory registered for id
error when trying to play sound. Xcode 12.2, Mac OSX Catalina 10.15.7, simulator running iOS 14.2.
Code had previously worked on prior versions of the simulator.
Problem ONLY happened when I had Mac System Preferences > Sound > Output set to my Logitech USB Headset. The code otherwise worked when: played through my LG Monitor, played through my Airpods Pro, and when executing on my iPhone 11 Pro.
Spent over an hour trying to diagnose the issue before restarting & noticing audio working when headset wasn't used for output.
Not even sure where to file this issue, but hoping it helps someone. Am assuming it's an OS-specific issue & not one that'll result in a problem w/the app or code.
I had the same problem, even after restarting the entire system. I quit Xcode, deleted Derived Data, and then things worked.
For those who have never deleted derived data, here's a primer: This is a url: - deriveddata.dance
Curiously, when I tried the suggestion above:
xcrun simctl --set previews delete all.
Output states:
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
I know I had previously had command-line tools on this machine. Is there something I'm missing or need to reinstall? Thanks!
When I try to drag the /Profiles/Runtimes/iOS 17.0 simruntime, I get the following error:
When I've tried running simple code (you can see in the image) accessing a TextField, when I tap in the text fields, the errors shown in the Debug Pane appear. This code works fine on the release version of Xcode. Any ideas what I should do? I've tried throwing Xcode beta into the trash, restarting the computer & reinstalling, both using the Xcodes.app & Apple's site (I used Apple's beta downloads page first). No luck. I'm using an M1 MacBook Pro & Ventura 13.4.
Yes. You should be able to run both. Unfortunately I haven't gotten Xcode 15 to work properly on my Mac, but Xcode 14 is running fine.
I've noticed when I have an array of data like my imageArray below, if I explore the data stored locally by the simulator, the array doesn't seem to be stored in extern storage. I come to this conclusion because if I look at the Application Support directory & try to find the ".default_SUPPORT" hidden folder, it's not there. If I were to simply create a model of single images, each of the single images is saved in a ".default_SUPPORT" that I can see. So I'm not sure if setting up .externalStorage with an array of images is doing anything. I'd be curious if anyone has thoughts. Here is the struct I'm using that's working with my app, but that doesn't seem to actually be saving the array of images in .externalStorage, or so I've concluded due to the lack of the hidden ".default_SUPPORT" directory.:
import Foundation
import SwiftData
@Model
class Place {
var city: String
var country: String?
@Attribute(.externalStorage) var imageArray: [Data?]
init(city: String, country: String? = nil, imageArray: [Data?] = []) {
self.city = city
self.country = country
self.imageArray = imageArray
}
}