Post

Replies

Boosts

Views

Activity

Reply to JSONEncoder has changed
If you mean the order of keys is now different (and you aren’t using the sortedKeys output option) then see this thread for discussion of why that is. how do I revert to the previous JSONEncoder while using current OS & Xcode versions? You can’t. That class is built into the Foundation framework in the operating system. But one workaround could be to try the old JSONSerialization class. It’s not great with Swift but (when I tried this a while ago) you may get the old key ordering behavior, at least for now. (Or is your issue different from key ordering? It’s not clear from the original question.)
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’23
Reply to Unable to parse JSON using decode function
If an error is getting thrown, can you provide the exact error message? Or is something else going wrong? Just “it is broken” is not helpful for troubleshooting. And what do “before” and “now” mean in terms of OS version, Xcode version, anything else that may have changed? BTW, I tried out your code here (Xcode 14.3.1, iOS 17 simulator) and it actually works fine for me.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’23
Reply to Downvote and spam reporting features broken?
Looks good, @App Store Connect Engineer. I’m able to downvote your reply above and report it for moderation. BTW, an unrelated issue: inserting an at-mention for your name doesn’t work right. If I hit the @ key it pops up a menu of thread participants as expected (you and @Claude31) but selecting your name results in just plain text in the final message as shown above.
Nov ’23
Reply to Accessing iOS Device Serial Number to Comply with German KassenSichV
There is no public API to get the serial number. That would be a massive privacy vulnerability. If your point-of-sale iPad devices are managed, then maybe you could push down an app-readable setting or file with each device’s own serial number. (But I’m no MDM expert.) Or worst case, you could manually provision each device by copy-and-paste from the Settings > General > About screen into your app. Hopefully this would satisfy the legal requirement.
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’23
Reply to Unable to get WiFi rssi value
I want to create a function which will return the rssi value of currently connected WiFi network on my iPhone. You can’t. There is no API for that. Please see iOS Network Signal Strength for details. I guess that support is no longer provided in Swift. There never was such support, and in fact the approach used in that code sample (poking in a private view hierarchy) is never a supported way to do anything on iOS. See the section on But what about this code I found on the ’net? at the link above. So moving on, the question is: why do you want the Wi-Fi signal strength? See the Network performance section for discussion of why this usually isn’t what you want. Or is the signal strength desired for a totally different purpose?
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’23
Reply to Missing multiple imports in CoreBluetooth.framework
The error message says Unknown class name but CBCentralManagerDelegate is a protocol. Is your code trying to use it in a context where a class name is expected? Or if this doesn’t help, can you post a small snippet of your app code that triggers the error? Also note that CBCentralManagerDelegate is declared in CBCentralManager.h rather than in its own file.
Nov ’23
Reply to Core Bluetooth Bug
Nobody can help with the error information in that format; please see points 5 and 8 in Quinn’s Top Fourteen DevForums Tips. But looking at the code, the signature for your delegate method isn’t correct: func centralManager(_: CBCentralManager, didDiscover: CBPeripheral, advertisementData: [String: Any], rssi: NSNumber) -> [Int] The return type of [Int] doesn’t match the protocol requirement (of no return type) and doesn’t make sense. This should have caused a compiler warning. If this method is actually getting called at run time, then the unexpected return value may cause undefined behavior, which could include sending your app off the rails with weird errors like that. What is the purpose of return BeaconRSSI in that method? Where is it attempting to return that value to? Even if it weren't crashing, Core Bluetooth calls the delegate method just to inform you of something (discovery of a peripheral) and wouldn’t know what to do with any value returned from it.
Dec ’23