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
Reply to Will Simulator Screenshots Ever Upload to Store
Can you give details of exactly which devices and sizes you are trying to upload, and exactly which screen size sections you are trying to upload them to, and exactly what the resulting error message is?
Replies
Boosts
Views
Activity
Nov ’23
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:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Downvote and spam reporting features broken?
Yep I can upvote yours. (And can un-upvote by just clicking the upvote button a 2nd time, removing the blue highlight.) But I think upvoting is free for everyone regardless of reputation points. They want the forum to be a happy place. :wink:
Replies
Boosts
Views
Activity
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.
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Encoding struct optional field to JSON
JSONSerialization is not the right JSON API to use with Codable or for Swift-only types generally. It’s designed for older Objective-C types (NSDictionary, etc.) and can’t handle Swift struct types. Instead, use JSONEncoder with Swift types; see here.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
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.
Replies
Boosts
Views
Activity
Nov ’23
Reply to Connecting to only one SSID when the network has multiple BSSIDs
If you haven’t already, please read TN3111: iOS Wi-Fi API overview. Then it sounds like you are doing the Temporarily join a network use case. Is this correct? Or if not, which use case applies to you?
Replies
Boosts
Views
Activity
Dec ’23
Reply to [[UIScreen mainScreen] bounds].size.width give wrong value on iOS 17.1.2 (iphone 13))
Does this thread describe what you are seeing?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Dec ’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.
Replies
Boosts
Views
Activity
Dec ’23
Reply to How to get wifi SSID information?
Please see TN3111: iOS Wi-Fi API overview.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to On recent versions of Xcode, in iOS simulators the ability to enable the 'Zoom' feature in accessibility is disappearing. Is there any solution to this ?
Can you clarify “recent versions” and “lower deployment target”? On a 17.2 simulator (iPhone SE 3rd gen.) I still see this option under Settings → Developer → View. Note this isn’t the same Settings path as on a real device.
Replies
Boosts
Views
Activity
Dec ’23
Reply to Should BOOL and bool be different types in Objective-C++?
This is mentioned in the Apple silicon porting guide: On Apple silicon, the compiler defines the BOOL type to be a native bool, but on Intel-based Mac computers, it is a signed char. But even though it works on Intel, I’d suggest that overloading that way could result in a confusing and error-prone API.
Topic: Programming Languages SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’23