Posts

Post not yet marked as solved
2 Replies
537 Views
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:)
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
1 Replies
389 Views
I'm unable to figure out how to know when my app no longer has focus. ScenePhase will only change when the WindowGroup gets created or closed. UIApplication.didBecomeActive and UIApplication.didEnterBackgroundNotification are not called either when say you move focus to Safari. What's the trick?
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
0 Replies
270 Views
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
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
0 Replies
279 Views
Using a button that is placed in the bottom ornament to set focus on a text field will not display the keyboard properly while a button embedded in the view will behave as expected. To demonstrate the issue, simply run the attached project on Vision Pro with visionOS 1.1 and tap the Toggle 2 button in the bottom ornament. You’ll see that the field does have focus but the keyboard is now visible. Run the same test with Toggle 1 and the field will get focus and the keyboard will show as expected. import SwiftUI import RealityKit import RealityKitContent struct ContentView: View { @State private var text = "" @State private var showKeyboard = false @FocusState private var focusedField: FocusField? private enum FocusField: Hashable { case username case password } var body: some View { VStack { TextField("Test", text: $text) .focused($focusedField, equals: .username) Text("Entered Text: \(text)") .padding() Button("Toggle 1") { // This button will work and show the keyboard if focusedField != nil { focusedField = nil } else { focusedField = .username } } Spacer() } .padding() .toolbar { ToolbarItem(placement: .bottomOrnament) { Button("Toggle 2") { // This button will set focus properly but not show the keyboard if focusedField != nil { focusedField = nil } else { focusedField = .username } } } } } } Is there a way to work around this? FB13641609
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
4 Replies
913 Views
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?
Posted
by Lucky7.
Last updated
.
Post marked as solved
3 Replies
482 Views
When displaying a view using a navigation Split View as a sheet, the toolbar button will disappear if you leave the app and resume it. import SwiftUI struct Folder: Hashable, Identifiable { let id = UUID() let name: String } struct ContentView: View { @State private var showingSettings = false var body: some View { VStack { Button { showingSettings.toggle() } label: { Text("Settings") } } .sheet(isPresented: $showingSettings, content: { SettingsView() }) .padding() } } struct SettingsView: View { @Environment(\.dismiss) private var dismiss @State private var selectedFolder: Folder? = nil private var folders = [Folder(name: "Recents"), Folder(name: "Deleted"), Folder(name: "Custom")] var body: some View { NavigationSplitView { SidebarView(selectedFolder: $selectedFolder, folders: folders) } detail: { VStack { if let folder = selectedFolder { Text(folder.name) } else { Text("No selection") } } .toolbar { ToolbarItem(placement: .cancellationAction) { Button { dismiss() } label: { Text("Cancel") } } ToolbarItem(placement: .confirmationAction) { Button { dismiss() } label: { Text("Save") } } } } } } struct SidebarView: View { @Binding var selectedFolder: Folder? var folders: [Folder] var body: some View { List(selection: $selectedFolder) { ForEach(folders) { folder in NavigationLink(value: folder) { Text(folder.name) } } } } } Steps to reproduce the issue: Launch the attached project on an iPad or iPad simulator Tap the Settings button Select one item in the sidebar Use the app switcher to open an other app or just leave the app Bring back the app Result: Both Cancel and Save buttons are gone. Note: This will not occur if no item is selected in the sidebar. FB12991687
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
0 Replies
320 Views
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.
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
0 Replies
280 Views
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?
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
2 Replies
382 Views
I found this 3-year old thread but at that time, linking transactions was not supported: https://developer.apple.com/forums/thread/650622?page=1#774420022 Essentially, I want to be able to get information about the transaction made by the purchaser but with a transaction that has ownershipType set to familyShared. Is this possible at the moment?
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
0 Replies
498 Views
It appears there's an issue with the Mac App Store's ability to process offer codes, unlike its iOS counterpart, which handles them seamlessly. Users attempting to redeem a code on their Mac are encountering a "Cannot redeem code. Try another code" error. Considering the Mac App Store's long history, having been introduced nearly 13 years ago, it's high time for it to align with the iOS App Store's functionality. While it's close to 80% there, addressing these lingering issues would greatly improve the user experience. FB13463658
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
0 Replies
323 Views
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
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
1 Replies
379 Views
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?
Posted
by Lucky7.
Last updated
.
Post not yet marked as solved
2 Replies
374 Views
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?
Posted
by Lucky7.
Last updated
.