Posts

Post not yet marked as solved
8 Replies
1.3k Views
It seems that @Model is not fully supported in visionOS. I've tried both an iPad app and a native visionOS app, and both crash when trying to use SwiftData. It's a minimal app from the template (no data) that I add a little data code to: import SwiftData @Model final class mapPin { var lat : Double var lon : Double init(lat: Double, lon: Double) { self.lat = lat self.lon = lon } } Building for visionOS produces: /var/folders/9p/ppkjrfhs393__cqm9z57k9mr0000gn/T/swift-generated-sources/@__swiftmacro_7Vision16mapPin5ModelfMm_.swift:2:13: error: declaration name '_$backingData' is not covered by macro 'Model' private var _$backingData: any SwiftData.BackingData<mapPin> = SwiftData.DefaultBackingData(for: mapPin.self) ^ /Users/arenberg/Developer/Beta/Vision1/Vision1/ContentView.swift:13:7: note: in expansion of macro 'Model' here final class mapPin { ^~~~~~~~~~~~~~ /var/folders/9p/ppkjrfhs393__cqm9z57k9mr0000gn/T/swift-generated-sources/@__swiftmacro_7Vision16mapPin5ModelfMc_.swift:1:1: error: type 'mapPin' does not conform to protocol 'PersistentModel' extension mapPin : SwiftData.PersistentModel {} ^ /Users/arenberg/Developer/Beta/Vision1/Vision1/ContentView.swift:13:7: note: in expansion of macro 'Model' here final class mapPin { ^~~~~~~~~~~~~~ /var/folders/9p/ppkjrfhs393__cqm9z57k9mr0000gn/T/swift-generated-sources/@__swiftmacro_7Vision16mapPin5ModelfMc_.swift:1:1: note: do you want to add protocol stubs? extension mapPin : SwiftData.PersistentModel {} ^ /Users/arenberg/Developer/Beta/Vision1/Vision1/ContentView.swift:13:7: note: in expansion of macro 'Model' here final class mapPin { ^~~~~~~~~~~~~~ /var/folders/9p/ppkjrfhs393__cqm9z57k9mr0000gn/T/swift-generated-sources/@__swiftmacro_7Vision16mapPin5ModelfMm_.swift:2:64: error: module 'SwiftData' has no member named 'DefaultBackingData' private var _$backingData: any SwiftData.BackingData<mapPin> = SwiftData.DefaultBackingData(for: mapPin.self) ^~~~~~~~~ ~~~~~~~~~~~~~~~~~~ /Users/arenberg/Developer/Beta/Vision1/Vision1/ContentView.swift:13:7: note: in expansion of macro 'Model' here final class mapPin { ^~~~~~~~~~~~~~```
Posted
by EdA.
Last updated
.
Post not yet marked as solved
1 Replies
731 Views
I'm creating a standalone WatchOS app using StoreKit 2. The code I have for making the purchase and checking the subscription status works under iOS 15. On WatchOS 8, after confirming the purchase, the product.subscription.status array is empty. I'm testing using the Xcode sandbox and I can see the purchase transaction there. I've talked with an Apple engineer and they think it may be a bug in WatchOS, but I'm reaching out here to see if anyone else has encountered this issue. Here's a code snippet: guard let product = store.subscriptions.first else { print("No Subscriptions"); return } guard let sub = product.subscription else { print("Not Subscription",product.id); return } let statuses = try await sub.status After the purchase, statuses has a value on iOS 15, but it's empty on WatchOS 8. "store" is my object to deal with StoreKit. Here's some relevant code that populates the store.subscriptions array. class Store: ObservableObject {   @Published private(set) var subscriptions: [Product]   @MainActor   func requestProducts() async {     do { //... keys are my product identifiers       let storeProducts = try await Product.products(for: keys)       for product in storeProducts {         switch product.type { // [snip]         case .autoRenewable:           newSubscriptions.append(product)         } }       subscriptions = sortByPrice(newSubscriptions) } // [snip]   } } I have tested this with Xcode 13.1 and 13.2b2.
Posted
by EdA.
Last updated
.
Post not yet marked as solved
0 Replies
974 Views
I have set up an app to monitor for both geofence (CLCircularRegion) and iBeacon (CLBeaconRegion) monitoring for entry / exit events. Everything works fine for about a day. I get entry / exit events (generate a UNNotificationRequest to show a local notification) just as I would expect. I can run multiple other apps that would presumably force my app out of memory, with an entry / exit event launching the handler that generates the notification. But a day later I stop getting the events, or at least stop getting the notifications. I'm running iOS 13 on an iPhone Xs. Any insights into what might be happening?
Posted
by EdA.
Last updated
.