Post not yet marked as solved
It seems like eye tracking comes into conflict with pointing devices and the cursor will jump to where the user looks at, which makes trackpad control very janky.
Is there a way to filter eye tracking and just enable pointing devices?
Post not yet marked as solved
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:)
Post not yet marked as solved
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?
Post not yet marked as solved
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
Post not yet marked as solved
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
Post not yet marked as solved
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?
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
Post not yet marked as solved
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.
Post not yet marked as solved
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?
Post not yet marked as solved
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?
Like the title says. Can you submit an app update and release it while the app is in pre-order?
I would assume that yes it is possible but I've never used pre-orders so I'd like to know if anyone here knows...
Thanks!
Post not yet marked as solved
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
Post not yet marked as solved
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
Post not yet marked as solved
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?
Post not yet marked as solved
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?