tvOS is the operating system for Apple TV.

Posts under tvOS tag

111 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Getting build error in tvOS for UITableView
I want to use uitableview in tvos to show list of string data but compiler is throughing following errors in generated header: "No type or protocol named 'UITableViewDataSource'" And "Attempting to use the forward class 'UITableView' as superclass of 'TWOSSelectionTableTVOS'" Even though this code is working is ios . My code structure is as follow : SelectionTable.swift: import UIKit class TWOSSelectionTableTVOS : UITableView { private var vDataSrc:[String]! func SetDataSrc (_ pDataSrc:[String]) { self.vDataSrc = pDataSrc } func UpdateDataSrc (_ pStringList:[String]) { self.vDataSrc += pStringList } func GetDataSrc () -> [String] { return self.vDataSrc } } PaintUI.swift : import UIKit @objc class PaintUI: NSObject,UITableViewDelegate, UITableViewDataSource { static let uShared = PaintUI () @objc static func updateUIMessage() { DispatchQueue.main.async { ExecuteInlineSelectionTable () } } func tableView (_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return 5 } func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell (withIdentifier: "cell", for: indexPath) cell.textLabel?.text = "hello" return cell } func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let viewcontroller: TWIOSViewController! viewcontroller = StaticContext.sViewController } public static func ExecuteInlineSelectionTable () { let selectiontable:TWOSSelectionTableTVOS! selectiontable = TWOSSelectionTableTVOS () selectiontable.register (UITableViewCell.self, forCellReuseIdentifier: "cell") selectiontable.dataSource = uShared selectiontable.delegate = uShared selectiontable.isScrollEnabled = true // TODO : will add selection table in view heriearchy but currently getting // compilation error } } And finally calling PaintUI.updateUIMessage () , it is throughing above errors for tvOS only but in case of ios code is working fine.
0
0
489
Jan ’24
AVPlayer kicks device off Airplay
On an Apple TV, if you have an app that triggers a video playing in AVPlayer while another device is air playing to the Apple TV. The device gets disconnected from Airplay and the video plays instead. There doesn't seem to be a way to sense that Airplay is happening or not happening from the Apple TV side programmatically or a way to prevent the behavior. Is this intentional? It would seem to make more sense to have Airplay take priority or push the app to the background.
0
0
680
Dec ’23
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
403
Dec ’23
tvOS app started crashing with 17.2, could not load NIB in bundle
I have a pretty basic tvOS app. It uses storyboard named 'Main'. Before a week ago, all was fine. It would load no problems at all. I installed 17.2 on my Apple TV, and it crashes as soon as it opens. I tested this out in Xcode and it runs on a 17.0 simulator, but the 17.2 simulator crashes and the only message I get is Exception NSException * "Could not load NIB in bundle: 'NSBundle </Users/Tyler/Library/Developer/CoreSimulator/Devices/A442BA1A-318B-43EC-850E-EA0CFA7AAB95/data/Containers/Bundle/Application/CC57DE61-B9E4-49EE-A044-8FE00D709CB6/Piedmont Road Apple TV.app> (loaded)' with name 'kQf-Ef-Nxz-view-nK4-c0-71Y'" 0x0000600000c73d50 I have put in breakpoints, but it doesn't seem to help. Anyone have an idea what got changed with tvOS 17.2 to cause this?
5
0
663
Dec ’23
Apple TV enrollment via apple configurator has no effect on the device
When we try to push blueprint for MDM over Wi-Fi in apple TV it fails, but in over the cable it works properly. After pushing the blueprint over Wi-Fi, the device gets rebooted and go through setup steps, at the end we don't see the step for Mobile Device Management. I'm attaching a sample Profile we attach to blueprint and Screenshot of Blueprint configuration.
2
0
610
Dec ’23
Trying to find button pressed but focusedItem is deprecated
In a tvOS app I have two buttons and would like to determine which one has focus when selected. Using func pressesBegan works for nw. override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) { guard let selected = UIScreen.main.focusedItem else { return } Xcode tells me that focusedItem is deprecated and I should use -[UIWindowScene focusSystem].focusedItem instead. Any suggestions on a code snippet that could be used. Thanks
0
0
391
Dec ’23
How to handle UIPhysicalKeyboardEvent?
I'm trying to improve our application to receive and handle events from a bluetooth keyboard. To intercept incoming events I use sendEvent: method. But I get a different event type for a different key. For example when I press 'Esc' key I get an event type is UIEventTypePresses (and event is a instance of UIPressesEvent class) but when I press 'ArrowUp' key I get an event type is 4 (there is no enum value for that number) and event is a instance of UIPhysicalKeyboardEvent class. In the first case I found a documentation of UIPressesEvent and I can implement handler for it. But for the second case I didn't find any documentations of UIPhysicalKeyboardEvent nether in the online documentation nor in the Xcode help. How can UIPhysicalKeyboardEvent events be handled? Is the any documentation for that? My target OS is tvOS 17.1
1
0
455
Dec ’23
TVOS 17 Alert tintColor Issue
The alertController.view.tintColor = .yellow statement does not seem to take effect in TVOS 17 when creating alerts. Interestingly, when using the same alert code on TVOS 16, the specified color is applied successfully. I'm seeking assistance in resolving this discrepancy and would appreciate any guidance or solutions you can provide. I could understand that the Alert design aswell is modified which is not mentioned in the release notes of TVOS 17. Please help me out here. TVOS 17: TVOS 16:
0
0
497
Dec ’23
NavigationSplitView, tvOS, and view focus
Hello, I have a SwiftUI application that uses NavigationSplitView. It's working great on iOS, iPad, and macOS. I decided to give it a try on tvOS. After it builds, it will not allow user interaction on the NavigationSplitView's sidebar. I've tried various view focus modifiers without any success. I'd also expect this to "just work" as default behavior. I have filed FB13447961 on this issue. Here is a distillation of the code that demonstrates the problem. Any ideas? Thank you. enum Category : String, CaseIterable { case first case second case third } enum Detail : String, CaseIterable { case one case two case three } struct DetailView : View { let category : Category? var body: some View { if let category { Text(category.rawValue) List(Detail.allCases, id: \.self) { detail in NavigationLink(value: detail) { Text(detail.rawValue) } } } else { Text("Select Category") } } } struct ContentView: View { // NOTE: If this category is set to something, it will show that category's detail. // The problem is that the NavigationSplitView sidebar does not have, nor does not // seem to be able to get focus. @State var category: Category? @State var path : [Detail] = [] var body: some View { NavigationSplitView { List(Category.allCases, id: \.self, selection: $category) { category in Text(category.rawValue) } } detail: { NavigationStack(path: $path) { DetailView(category: category) .navigationDestination(for: Detail.self) { detail in Text("\(detail.rawValue)") } } } } } #wwdc2023-10162 #wwdc20-10042
0
0
564
Dec ’23
'Runs as Current User' on tvOS causes Core Data to reset
My app uses Core Data to store user data. It doesn't have login or profile mechanisms, because user data is tied to the user's Apple ID and synced via iCloud using CloudKit. I've recently added the User Management capability, and checked Runs as Current User to allow each Apple TV user to have access to its own data. Everything works as expected: I press and hold the TV button to select a different user in Control Center; The system shows a switching user UI; And the app is relaunched using the new user's Apple ID and data from iCloud. The problem is that switching users apparently causes the local Core Data managed database to be reset, removing all data from the previous user. This is inconvenient because every time we switch users, the newly selected user has to wait for CloudKit to download all its data back into the app. And it takes a while, especially for users that have more than a few hundred items in the database. Ideally, tvOS should maintain the user data on-device, and only switch to a different database according to the active user. This way data would not need to be downloaded from scratch every time a user is switched. Is there a setting I can configure or a checkbox I can check to enable this behavior, or is this something not possible yet on tvOS?
0
0
401
Dec ’23
Apple TV A2843 Dolby Vision Pink Distorted Picture at 23.9Hz and 29.9Hz Pioneer SC-LX904 Sony XR-90J
Hello friends, my Apple TV A2843 is connected to a Pioneer SC-LX904 AVR that passes the signal to a Sony XR-90J TV. The TV is set to Enhanced Dolby Vision and the AVR HDMI is set to Enhanced too. The Format on my Apple TV is 4K Dolby Vision at 60HZ. Auto Frame and Dynamic Range match are on. The Color is set to RGB 24 bit automatically when the DV 60HZ format is selected and I cannot switch the Color from RGB back to YUV 4.4.4, 4.2.2 or 4.2.0. 4K Dolby Vision works perfectly at 60HZ and 50HZ. 4K Dolby Vision is not working (pink distorted Picture) at 23.9HZ and 29.9HZ When I swap the Apple TV A2843 with a Apple TV A1842 everything works perfectly. When I connect the Apple TV A2843 directly to the tv's HDMI 2.1 everything works perfectly. Months ago on March 2023 the problem was fixed with the 16.4 Beta (16.4 20L5474e) and it came back with the 16.4 RC and 16.4 Public. I haven't seen a fix since then. I have an older Apple TV A1842 that works fine all the time. Thank You
0
0
531
Nov ’23
AVPlayer playing video 6x or more faster than normal rate
0 I have a TV app which is used in Fitness industry where 6 smart TVs connected to Apple TVs and the App playing videos from a local server. Unitl tvOS 17.0 everything was smooth but soon after that we are facing a strange issue in that sometimes same Video is playing 6x or more faster than normal rate only in 1 random TV. I can see 12 min video finished playing in 1.3 min. Video Codecs: MPEG-4 AAC, H.264. Is these format affects speed in Apple TV? TVs are initially runs Intro videos, then warm up, then exercise and at last cooldown. I added the code for exercise background timer video where I am facing issue. On top on background video there are other 4 videos playing in loop. Please find attached image. I am using AVPlayer, Swift 5, Xcode 5 and tvOS 17.0, Apple TV 4K. code-block import UIKit import AVKit import AVFoundation class ViewController: UIViewController { @IBOutlet weak var workoutCircuitContainerView: UIView! var workoutCircuitPlayerItem: AVPlayerItem? var workoutCircuitPlayerLayer: AVPlayerLayer? var workoutCircuitPlayer: AVPlayer? var isWorkoutCircuitPlayerObserverAdded: Bool = false private var workoutCircuitObserverContext = 0 override func viewDidLoad() { super.viewDidLoad() } override func viewWillAppear(_ animated: Bool) { initializeWorkoutCircuitPlayer() } func initializeWorkoutCircuitPlayer() { workoutCircuitPlayer?.pause() workoutCircuitPlayerLayer?.removeFromSuperlayer() self.removeWorkoutCircuitPlayerObservers() startWorkoutCircuitPlayer() } func startWorkoutCircuitPlayer() { guard let streamURL = URL(string: "http://192.168.1.116:3001/videos/CARDIO_Work_Circuit1.mp4") else { return } self.workoutCircuitPlayerItem = AVPlayerItem(url: streamURL as URL) self.workoutCircuitPlayer = AVPlayer(playerItem: self.workoutCircuitPlayerItem) self.workoutCircuitPlayerLayer = AVPlayerLayer(player: self.workoutCircuitPlayer!) self.workoutCircuitPlayerLayer!.videoGravity = AVLayerVideoGravity(rawValue: AVLayerVideoGravity.resizeAspectFill.rawValue) self.workoutCircuitPlayerLayer!.frame = self.workoutCircuitContainerView.bounds self.workoutCircuitContainerView.layer.addSublayer(self.workoutCircuitPlayerLayer!) self.workoutCircuitPlayer!.addObserver(self, forKeyPath: "timeControlStatus", options: [.old, .new], context: nil) self.playWorkoutCircuitPlayer() self.addWorkoutCircuitPlayerObservers() } func playWorkoutCircuitPlayer() { workoutCircuitPlayer?.play() } func addWorkoutCircuitPlayerObservers() { if !isWorkoutCircuitPlayerObserverAdded { workoutCircuitPlayer?.addObserver(self, forKeyPath: #keyPath(AVPlayerItem.status), options: [.old, .new], context: &workoutCircuitObserverContext) NotificationCenter.default.addObserver(self, selector: #selector(self.workoutCircuitPlayerDidFinishPlaying), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: workoutCircuitPlayer?.currentItem) NotificationCenter.default.addObserver(self, selector: #selector(self.workoutCircuitPlayerStalled(note:)), name: .AVPlayerItemPlaybackStalled, object: self.workoutCircuitPlayer?.currentItem) isWorkoutCircuitPlayerObserverAdded = true } } @objc func workoutCircuitPlayerDidFinishPlaying(notification: NSNotification) { // play cool down videos code } @objc func workoutCircuitPlayerStalled(note: NSNotification) { if let playerItem = note.object as? AVPlayerItem { playerItem.seek(to: (workoutCircuitPlayer?.currentTime())!, completionHandler: nil) self.workoutCircuitPlayer!.play() } } func removeWorkoutCircuitPlayerObservers() { if isWorkoutCircuitPlayerObserverAdded { workoutCircuitPlayer?.removeObserver(self, forKeyPath: #keyPath(AVPlayerItem.status), context: &workoutCircuitObserverContext) NotificationCenter.default.removeObserver(self, name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: workoutCircuitPlayer?.currentItem) NotificationCenter.default.removeObserver(self, name: NSNotification.Name.AVPlayerItemPlaybackStalled, object: workoutCircuitPlayer?.currentItem) isWorkoutCircuitPlayerObserverAdded = false } } }
0
0
499
Nov ’23
How to implement search controller on search view controller with side menu in appletvos
class SearchController: UISearchController { override func viewDidLoad() { super.viewDidLoad() } override func viewWillDisappear(_ animated: Bool) { let appDelegate = UIApplication.shared.delegate as! AppDelegate AppDelegate.searchFlag = true DispatchQueue.main.async(execute: { self.searchBar.text = "abc" }) } override func viewWillAppear(_ animated: Bool) { self.view.frame.origin.y = 400 self.view.frame.origin.x = 400 } } how to add this SearchController on search view controller because when use this code self.present(appDelegate.searchController, animated: true, completion: nil) it is showing full width screen
0
0
323
Nov ’23
XCTest tvOS UI testing: focus on element without navigation
For iOS, it can send tap() event to an element, that means it doesn't need to explicitly navigate the UI to focus on the element first. Based on the document "Available in iOS and for Touch Bar interactions in macOS.", such events (like tap, click) don't support for tvOS , seems like for tvOS XCTest, I have to explicitly navigate the UI to locate the element first, and then send remote event like "select()" to trigger the click event. Anyone know is this the only way for tvOS?
0
0
385
Nov ’23
App Review Guys Getting Worse?
I don't know if it's just me lately but it seems the review guys for app submissions and updates have lost several hundred thousand brain cells. I guess it depends on who actually touches your submission but I've had a lot of copyright and random app performance rejections for like the past year and a half. There are no performance issues with the apps created as they're all made the same just pointing to different content which all work and after a resubmission it gets passed anyway. The copyright one makes sense for new apps and that's always provided yet somehow they sometimes miss that it's been included with the submission anyway and eventually passes when pointed out or resubmitted, but they'll also do it for updates to apps that have been published for years now and even when adding another platform. Ex Apple TV app around for years then add an IOS version for it BAM flagged for rejection over copyright. Some apps being updated from v1X to 2X BAM flagged for copyright. It doesn't make any sense. Anyone else seeing this? The support guys never answer my questions. Just spam the same copy/paste posts. Quite infuriating.
0
0
425
Nov ’23
Detecting Video Playback Status of Other Apps on AppleTV?
I'm interested in determining whether another AppleTV app is currently playing a video or not, without accessing the actual content or violating any privacy policies. I'm aware of the privacy and security concerns related to accessing other app's data, and I want to ensure that any solution I implement is in compliance with Apple's guidelines and respects user privacy. My goal is to provide enhanced user experiences without compromising security or privacy. Is there any legitimate and secure way to achieve this functionality? I appreciate any guidance or information you can provide on this matter. Thank you for your time and assistance! :)
0
0
495
Nov ’23