Post

Replies

Boosts

Views

Activity

Xcode crashes editing any packages - Segmentation Fault
Hello all. I am trying to work on some packages, but if I go to the project navigation and do anything from starting to edit a file, to creating a file, folder etc, Xcode immediately crashes with segmentation fault. I am not running anything. This only happens with the packages, if I open a regular project or workspace and work on it, it's fine. Other people I am working with do not seem to have this issue. I will post the full log here, I tried putting a snippet here but it says I'm not allowed to CrashReport.txt Thank you very much Hardware: MacBook Pro, Chip M1 Pro, macOS Monterey v12.5.1
1
0
1.2k
Jun ’23
Why is this returning nil when casting to String:Any
Hi all. I've been looking at examples of using alamofire, json etc. For a downloader I have a function that takes some parameters of String:Any Then my view controller calls this function passing in parameters, uses almofire to retrieve the data, and returns "json" Then in my view controller I have after that guard let responseFromJson = json as? [String: Any] else { print("Whatever message") return } This always goes to the else statement and responseFromJson is of value nil. I'm learning Swift and I'm a bit confused, because every other example I've seen online uses if not the same method, very similar and every question has answers saying the same. My debugger says json is of type "Any?" with NSDictionaries in it, but the terminal tells me it's of NSArray with NSDictionaries. If I do guard let responseFromJson = json as? NSArray It's the only way I don't get a nil. I've been at this for hours and I'm very lost. Thanks EDIT: Folks let this be a lesson on why not to program 12 hours straight. A few minutes after posting this and getting off, I realized "wait, I have an array of dictionaries, not a single dictionary". The solution is guard let responseFromJson = json as? [[String: Any]] Which is another way of saying Array<DictionaryString:Any> Sorry everyone!
1
1
464
Oct ’22