Post

Replies

Boosts

Views

Activity

.refreshable on macOS?
Is .refreshable supposed to do anything on macOS? Works fine on iOS and iPadOS but it's not triggered on macOS. It's available since macOS 12 but the documentation doesn't mention anything about that. https://developer.apple.com/documentation/swiftui/view/refreshable(action:)
2
1
1.1k
Mar ’24
onKeyPress not working on iOS/iPadOS 17.4 but fine on macOS
According to a post on hackingwithswift.com, this should work on iOS/iPadOS: import SwiftUI struct ContentView: View { @FocusState private var focused: Bool @State private var key = "" var body: some View { Text(key) .focusable() .focused($focused) .onKeyPress { press in key += press.characters return .handled } .onAppear { focused = true } } } It does not work for me using a hardware keyboard on an iPad running the latest iPadOS 17.4 beta but it does work on my Mac. FB13644182
1
0
861
Feb ’24
NSCocoaErrorDomain 4097: connection to service named com.apple.storekitagent
We had a few users reporting this issue where our app is unable to connect to StoreKit. Failed product request from the App Store server: systemError(Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.storekitagent" UserInfo={NSDebugDescription=connection to service named com.apple.storekitagent}) This occurs when calling Product.products(for:). Some users mentioned they had to restart their Mac in safe mode to make the error go away, some had DNS cache issues and clearing those helped, or some found the culprit to be Adguard. What could be causing this error as it is not very clear what's causing it?
4
0
3.5k
Feb ’24
Transaction.currentEntitlements never returns if there are no entitlements?
I'm uncertain about the reason behind Transaction.currentEntitlements not returning nil when there are no current entitlements. The challenge I'm facing is that, in the scenario where a trial period concludes, Transaction.currentEntitlements seems to perpetually withhold any response, leaving me without a means to discern the conclusion of the trial. I'm puzzled as to why this method doesn't simply return nil when no entitlements are detected. It would be immensely helpful if someone could shed light on the rationale behind this behavior or point out any potential errors in my understanding. Your insights would be greatly appreciated. Thanks.
0
0
717
Dec ’23
IAP rejected (Guideline 2.1) while binary waiting for review?
That's a new one for me. I have submitted 2 IAP along with an update for my app. The Mac binary was approved but then one of the IAP was rejected with this message: "We have returned your IAP product/s to you as the required binary was not submitted. When you are ready to submit the binary, please resubmit the IAPs with the binary." I'm not sure what this means as the related binary is actually waiting for review. What does this error means and how can I fix it?
0
0
657
Dec ’23
Context menus, alerts, popovers and tips do not respect preferred color scheme
It seems like some UI elements just don't use the preferred color scheme of their parent element: import SwiftUI struct ContentView: View { var body: some View { VStack { Button("Hold Me") { } .contextMenu(ContextMenu(menuItems: { Button("I should be dark") { } })) } .padding() .preferredColorScheme(.dark) } } If you set the device appearance to dark, then the context menu shows the correct color scheme. Setting .preferredColorScheme(.dark) to Button directly doesn't help. Aside from context menus, this applies to all sorts of elements: popovers, alerts, tips, ... Is there a workaround for this? Apple folks: FB13391355
0
0
655
Nov ’23
Is StoreKit.Transaction.currentEntitlements down at the moment?
Calling StoreKit.Transaction.currentEntitlements today just doesn't return. It just sits there. for await result in StoreKit.Transaction.currentEntitlements { switch result { case .verified(let transaction): currentTransaction = transaction case .unverified(let transaction, let error): currentTransaction = transaction } } The for loop never starts. This is using a Sandboxed user that made a renewal subscription purchase. Everything was working fine yesterday. Nothing on my end has changed since then. Is something wrong with StoreKit?
1
0
760
Nov ’23
manageSubscriptionsSheet not showing
Trying to debug StoreKit on device using a sandboxed user. When I want to show manageSubscriptionsSheet, the screen flashes but nothing shows. This is visible in the console: SKEngagementRemoteViewTask: Presenting system engagement request. Request: {length = 5347, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 000012d7 } Present engagement request: {length = 5347, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 000012d7 }, clientBundleID: com.acme.myapp Finished presenting engagement request with view service There isn't much information in the documentation so I'm not sure if it's me not doing things correctly or a bug in iOS 17.2?
2
0
878
Nov ’23
Unable to export Strings Catalog
I've spent 3 days moving localization from my older project to my new project and converted to Strings Catalog. When I tried to export, I got the Unable to build project for localization string extraction error. Read about that and the workaround seems to be to set Localisation Export Supported to NO, which I did. I worked once and now it refuses to export and complains about missing targets, which I had to remove from the export process as recommended. WTH? Or, at some point it complained about a missing Swift Package. wwdc2023-10155
2
0
1.1k
Nov ’23
iOS 17b6: Simultaneous accesses to ..., but modification requires exclusive access crash using Observation and SwiftUI
Since iOS/iPadOS beta 6, I get a crash just by simply selecting an item in the sidebar of a navigation view. The selected item is part of an app mode, with conforms to the Observation protocol: import SwiftUI import Observation @main struct MREAApp: App { @State private var appModel = AppModel.shared var body: some Scene { WindowGroup { ContentView() .environment(appModel) } } } @Observable class AppModel { static var shared = AppModel() var selectedFolder: Folder? = nil } struct Folder: Hashable, Identifiable { let id = UUID() let name: String } struct ContentView: View { @Environment(AppModel.self) private var appModel var folders = [Folder(name: "Recents"), Folder(name: "Deleted"), Folder(name: "Custom")] var body: some View { NavigationSplitView { SidebarView(appModel: appModel, folders: folders) } detail: { if let folder = appModel.selectedFolder { Text(folder.name) } else { Text("No selection") } } } } struct SidebarView: View { @Bindable var appModel: AppModel var folders: [Folder] var body: some View { List(selection: $appModel.selectedFolder) { ForEach(folders, id: \.self) { folder in NavigationLink(value: folder) { Text(folder.name) } } } } } To reproduce the bug, just tap on one of the item. Oddly enough, this works fine in the Simulator. macOS 14 beta 5 is not affected either. Apple folks: FB12981860
16
2
4.0k
Oct ’23