Using the Implementing a Store In Your App Using the StoreKit API sample code, I've successfully integrated my new APP with StoreKit 2. There is one problem though: when I call the method Transaction.latest(for:) to get the user’s latest transaction, it always returns nil.
Here's the code snippet:
guard let result = await Transaction.latest(for: myProductId) else {
return false
}
Is this a bug with StoreKit 2, or am I doing something wrong? This happens on a physical device, running from Xcode. Thanks in advance.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm sharing a Core Data store with my action extension, which adds data to it. My app has a SwiftUI view that presents this data, fetched with a FetchRequest:
private struct VideosScrollView: View {
@Environment(\.managedObjectContext) private var viewContext
private var fetchRequest: FetchRequest<Video>
init(sortOrder: String, tagIds: String, showWatched: Bool) {
fetchRequest = Video.getFetchRequest(sortingBy: "addDate",
with: sortOrder,
showWatched: showWatched,
tagIds: tagIds)
}
var body: some View {
ScrollView {
if fetchRequest.wrappedValue.isEmpty {
ContentEmptyView()
} else {
ForEach(fetchRequest.wrappedValue) { item in
VideoCellView(video: item)
}
}
}
}
}
After adding data from the action extension and going back to the app, the view is not updated. Only after CloudKit finished a sync is that the view notices something changed and updates itself.
How can I force my SwiftUI view to update when data changes in the action extension?
My app has an action extension that allow users to collect and save links throughout the system. It also has a widget to show these links in the Home Screen.
When adding links from the main app, I call WidgetCenter.shared.reloadAllTimelines() to reload all widgets, and everything works as expected.
But when I add links from the action extension, widgets are not reloaded, even after calling WidgetCenter.shared.reloadAllTimelines(). Only when I go to the main app is that widgets do reload.
How can I refresh my widgets for changes made via the Action Extension from the share sheet?
On a macOS app generated with Catalyst, the method SKCloudServiceController.requestUserToken(forDeveloperToken:completionHandler:) returns a SKErrorDomain. The error is:
Error Domain=SKErrorDomain Code=0 "Ocorreu um erro desconhecido" UserInfo={NSLocalizedDescription=Ocorreu um erro desconhecido}
Has something changed regarding this method on macOS or is this a bug?
I noticed that sometimes, when opening my Mac Catalyst app, the window is not resized to the size I left it the last time.
Should I restore it manually when launching the app, or is the system responsible for it? And if it so, why it doesn't work sometimes?
I have a screen with two List side by side, inside a NavigationView. The layout is rendered correctly, and I can independently scroll both lists. The problem is that, when I scroll the first list, it goes behind the navigation bar without triggering the effect of applying a background color to it. Here's a gif showing what's going on:
And this is the code I'm using for this view:
struct ContentView: View {
var body: some View {
NavigationView {
HStack(spacing: 0) {
List {
Section(header: Text("Header left")) {
ForEach(0..<600) { integer in
Text("\(integer)")
}
}
}
.listStyle(InsetGroupedListStyle())
.frame(minWidth: 0, maxWidth: .infinity)
List {
Section(header: Text("Header right")) {
ForEach(0..<400) { integer in
Text("\(integer)")
}
}
}
.listStyle(InsetGroupedListStyle())
.frame(minWidth: 0, maxWidth: .infinity)
}
.navigationTitle("Example")
}
.navigationViewStyle(StackNavigationViewStyle())
}
}
Would this be a SwiftUI bug? If not, how can I make the first list correctly interact with the navigation bar when scrolling?
WWDC21 Session Focus on iPad keyboard navigation says that we can use UIFocusHaloEffect to change the appearance of focused items.
On iPadOS, we can use this effect by assigning a UIFocusHaloEffect to the focusEffect property like so:
self.focusEffect = UIFocusHaloEffect()
What wasn't very clear is where should we put this code when working with UICollectionViewCell. I am doing it in the collectionView(_:canFocusItemAt:) method:
func collectionView(_ collectionView: UICollectionView, canFocusItemAt indexPath: IndexPath) -> Bool {
guard #available(iOS 15.0, *) else { return false }
guard let cell = collectionView.cellForItem(at: indexPath) as? FeedCollectionViewCell else { return false }
if cell.focusEffect == nil {
cell.focusEffect = UIFocusHaloEffect(roundedRect: cell.artworkImageView.frame,
cornerRadius: cell.cornerRadius,
curve: .continuous)
}
return true
}
Is this the best way to implement it?
Before beta 4 this worked as expected. After updating to beta 4, all my UICommands inside UIMenu on NSMenuToolbarItem.itemMenu are now disabled, and I can't figure out how to enable them.
Here's my itemForItemIdentifier method:
func toolbar(_ toolbar: NSToolbar, itemForItemIdentifier itemIdentifier: NSToolbarItem.Identifier, willBeInsertedIntoToolbar flag: Bool) -> NSToolbarItem? {
		let item = NSMenuToolbarItem(itemIdentifier: itemIdentifier)
		item.itemMenu = UIMenu(title: "", options: .displayInline, children: [UICommand(title: "Test", action: #selector(onTestTap))])
		item.image = UIImage(systemName: "ellipsis.circle")
		return item
}
Am I doing something wrong or is this a bug on macOS Big Sur beta 4?
On a Catalyst app, the CLLocationManagerDelegate method didUpdateLocations is never called.
I have requested permission using requestLocation.
After granting it, the locationManagerDidChangeAuthorization method is called, with a positive authorizationStatus.
There I call requestLocation on the CLLocationManager object, but neither didUpdateLocations nor didFailWithError delegate methods are called.
The same code works as expected on iOS.