Post

Replies

Boosts

Views

Activity

MapKit animations on tvOS result in hang
Hardware: Apple TV 4K (1st gen) OS: tvOS 17.1 I have been attempting to create a simple dashboard using MapKit for my company's devices located around the globe. As of now, we only have 7-8 attached to the main database, so I'm using an API client I created to load that many Map markers after the View is loaded. My issue is that despite this being a relatively low-intensity task, the Map view crashes after about 15 minutes, with no errors or any indications of memory leaks or other problems that would indicate something is wrong. GPU usage spikes on initial load, but remains in the green throughout the process. I tried the same code in swift playgrounds and was able to get the globe to spin indefinitely, probably because it's using the extra resources available on my M2 Max chip. But again, I am well below the memory and CPU usage limits available for tvOS. other than initially loading 7-8 objects asynchornously on initial load, no other work is being done. MRE: import SwiftUI import MapKit struct ContentView: View { let timer = Timer.publish(every: 0.1, on: .main, in: .default).autoconnect() @State var viewport: MapCameraPosition = .region(MKCoordinateRegion(center: .init(latitude: 0, longitude: 0), span: .init(latitudeDelta: 90, longitudeDelta: 180))) @State var longitude: Double = 0 { didSet { viewport = .region(MKCoordinateRegion(center: .init(latitude: 20, longitude: longitude), span: .init(latitudeDelta: 90, longitudeDelta: 180))) } } private func shiftLongitude(by: Double) { if self.longitude >= 180 { self.longitude -= 360 } else { self.longitude += by } } var body: some View { Map(position: $viewport) { } .mapStyle(.imagery(elevation: .realistic)) .onReceive(timer) { _ in withAnimation { self.shiftLongitude(by: 1.0) } } } }
1
0
536
Dec ’23
use of @Model macro from SwiftData causes project build to fail
Target tvOS 17.4 macOS Version 14.5 Xcode Version 15.4 (15F31d) I am working on integrating SwiftData (not migrating from CoreData) into an app in active development for tvOS, and I cannot get the project to compile whenever the @Model macro is introduced. I've traced every error back to the code generated by the @Model, and commenting it out removes the errors. I am able to use @Model on a fresh project, but any attempt to import SwiftData results in the build failing with the following errors: /var/folders/t5/c9qp7_4j19x9s3p3z26kn6v80000gn/T/swift-generated-sources/@__swiftmacro_9AeolusKit11DeviceModel0D0fMe_.swift:1:1 Type 'DeviceModel' does not conform to protocol 'Observable' /var/folders/t5/c9qp7_4j19x9s3p3z26kn6v80000gn/T/swift-generated-sources/@__swiftmacro_9AeolusKit11DeviceModelC2id18_PersistedPropertyfMa_.swift:4:9 Member 'setValue' cannot be used on value of type 'any BackingData<DeviceModel>'; consider using a generic constraint instead /var/folders/t5/c9qp7_4j19x9s3p3z26kn6v80000gn/T/swift-generated-sources/@__swiftmacro_9AeolusKit11DeviceModel0D0fMe_.swift:4:36 'Observable' is not a member type of struct 'AeolusKit.Observation' /var/folders/t5/c9qp7_4j19x9s3p3z26kn6v80000gn/T/swift-generated-sources/@__swiftmacro_9AeolusKit11DeviceModelC2id18_PersistedPropertyfMa_.swift:4:50 Cannot convert value of type 'String' to expected argument type 'PersistentIdentifier' /var/folders/t5/c9qp7_4j19x9s3p3z26kn6v80000gn/T/swift-generated-sources/@__swiftmacro_9AeolusKit11DeviceModelC2id18_PersistedPropertyfMa_.swift:8:54 Cannot infer key path type from context; consider explicitly specifying a root type /var/folders/t5/c9qp7_4j19x9s3p3z26kn6v80000gn/T/swift-generated-sources/@__swiftmacro_9AeolusKit11DeviceModelC2id18_PersistedPropertyfMa_.swift:12:64 Cannot infer key path type from context; consider explicitly specifying a root type /var/folders/t5/c9qp7_4j19x9s3p3z26kn6v80000gn/T/swift-generated-sources/@__swiftmacro_9AeolusKit11DeviceModel0D0fMm_.swift:25:50 Type 'Observation' has no member 'ObservationRegistrar' the code in question causing the error: import Foundation import SwiftData @Model public final class DeviceModel { @Attribute(.unique) public var id: String init(id: String) { self.id = id } } I've already done the following: clean the project erase the contents of the derived directory restart xcode restart my mac. I want to emphasize, I do not believe it is my code causing this issue, as commenting out the @Model result's in a perfectly normal build with no warnings or errors Any help is appreciated
2
0
605
Jun ’24
OSStatus error:[-34018]
Every topic I can find online about this entitlement error suggests I don't have the correct entitlements on. I do in fact have the correct entitlements enabled, but xcode doesn't seem to recognize them. dev@dev-MacBook-Pro Debug-appletvos % codesign -d --entitlements - ProductName.app Executable=/Users/dev/Library/Developer/Xcode/DerivedData/ProductName-cmaicvialhhqtnbvmwehlympuxua/Build/Products/Debug-appletvos/ProductName.app/ProductName [Dict] [Key] application-identifier [Value] [String] <teamID>.Company.ProductName [Key] com.apple.developer.associated-domains [Value] [Array] [String] webcredentials:<api_url> [Key] com.apple.developer.team-identifier [Value] [String] <teamID> [Key] com.apple.developer.user-management [Value] [Array] [String] get-current-user [Key] com.apple.developer.weatherkit [Value] [Bool] true [Key] com.apple.security.application-groups [Value] [Array] [String] group.Company.ProductName [Key] get-task-allow [Value] [Bool] true [Key] keychain-access-groups [Value] [Array] [String] <teamID>.com.Company.ProductName [String] <teamID>.Company.ProductName OSStatus error:[-34018] Internal error when a required entitlement isn't present, client has neither application-identifier nor keychain-access-groups entitlements. I am unsure about the application-identifier part, as this isn't even an option in the entitlements, and keychain sharing was already turned on. These errors stop my app from launching. A few days ago this wasn't an issue. Now after launching xcode again this suddenly becomes an issue out of nowhere. Platform: tvOS simulator runtime and Apple TV 4k (3rd generation) Target version: 18.0 Development Hardware: macbook pro m2 max Development Software: macos Sonoma 14.5
2
0
481
Aug ’24