tvOS is the operating system for Apple TV.

tvOS Documentation

Posts under tvOS tag

124 Posts
Sort by:
Post not yet marked as solved
0 Replies
473 Views
Hi guys, Since SwiftUI is not completely suporting tvOS remote and swipe/pan gestures (targeting tvOS 16 and higher, using Xcode 15.1 and its tvOS SDK), I have implemented custom remote control handling using GameController framework and GCController class to detects Siri Remote (1st and 2nd generation), iOS Remote (tvOS remote controller on iPhone) and Nimbus+ and PS game controllers. For video streaming app I specifically needed to handle arrows on old Siri remote and new Siri remote the same way - arrow press (not just touch) switches TV channel. In the standard SwiftUI remote control handling the arrow presses are triggered on old remote just by touching edges of the touch pad. We use Up/Down arrow presses to switch TV channel. Our testers reported that they too often accidentally change channel when picking up remote or simply laying down finger on the pad in preparation to use the remote for some action. That's why we needed to override default behavior on old remote and detect arrow press only when user touches the edge and "clicks" the touch pad. Simultaneously we detect input from all controllers, because for example when you have Nimbus game controller connected it becomes current controller - it is set in GCController.current - while we still need to handle Siri remote, so user didn't have to turn off Game controller and could just pick up the Siri remote and use it right away. But there are still some problems. For example if I open tvOS remote control app on iPhone it has higher priority over Siri remote. Although I'm able to hold iPhone in one hand and Siri remote in the other and use them simulatanously, pressing down arrow buttons on Siri remote triggers event, which is being detected as if it came from iOS remote. This problem occurs even if user locks iPhone while remote app is active. User has to unlock iPhone and minimize iOS remote to fix the problem and make Siri remote fully active controller with arrows working as expected. Is there a way of detecting from which remote the button press event came? GCController.current reports that iOS remote is current controller, notification GCControllerDidConnect and GCControllerDidBecomeCurrent does not help either. When I use iOS remote it becomes current controller and when I start using Siri remote and press button it does not become current controller. GCController.physicalInputProfile does not help either. It is as if iOS remote while being connected to tvOS has higher priority over Siri remote. Why don't I receive current controller change when pressing button on Siri remote? When pressing the button on Siri remote and receiving event, it comes from handler with GCController.microGamepad.elements.count == 10, instead of 17, so although I'm pressing button on Siri remote I'm getting events as if I pressed button on old remote (or iOS remote which is handled as old Siri remote). Even button.controller instance is wrong and holds a reference to iOS remote instead of the correct new Siri remote. I tried to look at button.aliases to see if I find "Cardinal Direction", which would hint at arrow press on new controller, but it does not contain this type of alias. I'm trying to find some hack for detection of currently used Siri remote, but without any success. It looks like somewhere in the core the GCController converts button presses to more generic events making the button presses anonymous (losing hardware info). But clearly the low level code must see from which controller the button press came. Any idea if there is a way of detecting from which remote controller the button press came?
Posted Last updated
.
Post not yet marked as solved
0 Replies
476 Views
Hello, my company ordered Apple TV 4K HDMI + WIFI only.. The device has no ethernet or USB-C port. Only has HDMI and power port. I read on Apple's website to connect to Apple configurator I have to do it via WIFI. I followed the steps from the Apple website (https://support.apple.com/en-ca/guide/apple-configurator-2/cada1ba9dab1/mac) but once I'm paired to the Apple TV and I try to "Prepare" in Apple configurator to get the device setup on MDM it tells me the AppleTV device is already prepared and asks to "Erase" which I do then the Apple TV is back to the beginning setup screen and no longer connected to WIFI... Once I run through the setup again and get back on WIFI and goto pair screen it says the same thing when I try to prepare again.. Just going in circles and not getting anywhere.. Anyone have a solution? Prepare Apple TV HD or Apple TV 4K using Wi-Fi or Ethernet Make sure your Apple TV is connected to the same network your Mac is connected to. Make sure the Apple TV is at the first screen of the Setup Assistant that says Pair Your Remote. Launch Apple Configurator 2 . From the Apple Configurator 2 menu, choose Paired Devices. Select your Apple TV in the Paired Devices list, then click Pair. Enter the six-digit personal identification number (PIN) that appears on the screen of your Apple TV. Select your Apple TV in the device window of the Apple Configurator 2. Click Prepare and follow the onscreen instructions to set up your Apple TV.
Posted Last updated
.
Post not yet marked as solved
0 Replies
408 Views
We have an video app that puts up it's own screen saver after some idle time to prevent TV screen burn-in. Is there a way to stop video (including downloading segments) while still maintaining audio playback? I see the currentItem has different tracks and can enable/disable closed captioning for instance, but this doesn't work for the video track. Is it even possible? -B
Posted
by byrtM.
Last updated
.
Post not yet marked as solved
0 Replies
446 Views
I have a tvOS project contains an App target and 3 static libraries: EntryPoint – Static library that contains main , AppDelegate and SceneDelegate Experience – Static library containing my UI elements AppTarget – executable built using above two libraries I have a class "SelectionTable" which subclasses UITableView in Experience target : import UIKit class SelectionTable : 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 } } I am not using this class anywhere and still i am getting these errors when i build my AppTarget: Cannot find interface declaration for 'UITableView', superclass of 'SelectionTable' Expected a type These above error are coming in generated header file "Experience-Swift.h". This file is auto-generated by compiler. I am not using @objc anywhere in the code, But still the Target-Swift.h file has the below lines: SWIFT_CLASS("_TtC10Experience22SelectionTable") @interface SelectionTable : UITableView - (nonnull instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER; - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER; @end When i am marking above class as Private , this error goes away . And also , if i am defining SelectionTable class in EntryPoint library , this error does not occur . I am using similar model for an iOS project also and there i am not facing this issue. I am using :- Swift version : Swift 5.9.2 XCode version : 15.2
Posted Last updated
.
Post not yet marked as solved
0 Replies
398 Views
Hello, We would like to create a custom keyboard for our tv app, while also keeping the features of dictation and device input (via phone or pad). However setting the inputView on the UITextField does not work. When the textfield is focused/selected it should show the inputView. Instead it does nothing, freezes and builds up memory usage slowly until it goes OOM and crashes. Setting any view (empty UIView()) on a UITextField will reproduce the issue. Reproducible on tvOS 16 and 17. Test project added to github for reproduction: https://github.com/drs-st/test-tvos-custom-inputview/blob/develop/TestKeyboard/ViewController.swift
Posted Last updated
.
Post not yet marked as solved
0 Replies
385 Views
I was shutdown tvOS simulator as hold TV/Control center button and select Shutdown. How turn on? Im trying press/hold menu/tv/any buttons, simulate not react, I see only black screen
Posted
by gruzd1sok.
Last updated
.
Post not yet marked as solved
2 Replies
465 Views
If users press the menu button multiple times from any page, it is likely to exit the app. I think it would be nice to have an alert before exiting the app. I have noticed that some apps on other platforms have this feature; however, I am not sure if it is allowed on tvOS. The logic would be something like this: Users tap the menu button. Show an alert with 'Cancel' and 'Exit' buttons. If 'Cancel' is tapped, go back to the app. If 'Exit' is tapped, exit the app by calling UIApplication.shared.perform(#selector(NSXPCConnection.suspend)). Will calling NSXPCConnection.suspend get my app rejected from Apple? It seems like a reasonable feature, though."
Posted
by ANATest.
Last updated
.
Post not yet marked as solved
3 Replies
623 Views
I have an AppleTV app which I released in 2016. I've updated it and released a new version every year without much hassle. This year, with tvOS 17.2, the layered app icon isn't working right. This is a two-layer image made with PNGs. When it's selected, it looks right and the layers move correctly: But when it's not selected, the background layer disappears: Screenshots are from the simulator but it also happens on the device. It's inconsistent; sometimes it's the front layer that disappears. Occasionally both layers work, but I can't tell why. I've spent a day trying everything. Very frustrated. The icon previews correctly in Xcode and in Parallax Viewer. The image sizes are correct: 400 x 240 for Small, 800 x 480 for Small@2x, 1280 x 768 for Large. The back layer is a non-transparent PNG. I tried adding a Large@2x set. Didn't help. Originally I had a three-layer image with no middle layer PNG. I deleted the empty middle layer, but that didn't help. All the PNG files are from GnuIMP. Same color space, even. I was using the filenames tvicon-back-s.png and tvicon-back-s@2x.png. I tried taking out the @ sign in case that was confusing Xcode. (It never has before, but I am flailing here.) Anybody have any clues? If it's an Apple bug and there's nothing I can do, I'm going to just push the release button and hope it fixes itself someday.
Posted
by erkyrath.
Last updated
.
Post not yet marked as solved
0 Replies
326 Views
Hi guys, I have Xcode 15.2 + MacOS Sonoma 14.2.1 + iPhone SDK 17.2 + Apple M3 chip When I build my project with FMOD for Unreal 2.0.2.20 for iOS Simulator on have an error: /Plugins/FMODStudio/Binaries/IOS/libfmodL_iphoneos.a(libfmodL_iphoneos.a-arm64-master.o) building for iOS Simulator, but linking in object file built for iOS**, file '/Plugins/FMODStudio/Binaries/IOS/libfmodL_iphoneos.a' Found that in downloaded latest verison "fmodstudio20220ue5.3mac.zip" from https://www.fmod.com/download#fmodforunreal inside folder "Plugins/FMODStudio/Binaries/IOS" there are no files for iOS Simulator (so it's not builded for support it or they just forgot to do it) So next i found on page https://www.fmod.com/docs/2.02/api/platforms-ios.html#ios-specific-starter-guide that they Released iOS simulator binary for Core Engine and Studio Engine FMOD Core Engine library /api/core/lib/libfmod_iphonesimulator.a - Release iOS simulator binary for production code. /api/core/lib/libfmodL_iphonesimulator.a - Release iOS simulator binary with logging enabled for development. FMOD Studio Engine library (used in conjunction with core library) /api/studio/lib/libfmodstudio_iphonesimulator.a - Release iOS simulator binary for production code. /api/studio/lib/libfmodstudioL_iphonesimulator.a - Release iOS simulator binary with logging enabled for development. So next step from page https://www.fmod.com/download#fmodengine I downloaded "fmodstudioapi20220ios-installer.dmg" inside 2 folders "/api/core/lib" and "/api/studio/lib" I found these files and copy it to my folder "/Plugins/FMODStudio/Binaries/IOS/", and it didn't work :slight_smile: So just to try luck I made a copy of this folder and deleted files that work for iOS build only libfmod_iphoneos.a libfmodL_iphoneos.a libfmodstudio_iphoneos.a libfmodstudioL_iphoneos.a Next step renamed files libfmod_iphonesimulator.a -> libfmod_iphoneos.a libfmodL_iphonesimulator.a -> libfmodL_iphoneos.a libfmodstudio_iphonesimulator.a -> libfmodstudio_iphoneos.a libfmodstudioL_iphonesimulator.a -> libfmodstudioL_iphoneos.a And finally I successfully builded and launched my project with FMOD for Unreal 2.0.2.20 for iOS Simulator FMOD team need to rebuild FMOD for Unreal with adding _iphonesimulator and _appletvsimulator files and support and it will launch on iOS/TVOS Simulators with any problems. PS same you can do with TVOS Simulator and fix it
Posted
by davaidev.
Last updated
.
Post not yet marked as solved
2 Replies
450 Views
I’m developing this tvOS app, and it builds and runs fine locally in Simulator. However, when I do Product > Archive (so I can upload it to app store later), it fails with error in the screenshot. Looks like Xcode is trying to sign the app with a certificate, but could not find a valid profile to do so. Since I don't have a physical Apple TV device, I'm unable to add an Apple TV to the Devices list on developer.apple.com, thus unable to create a profile. Is the any way around this issue to archive my tvOS app?
Posted
by hliang.
Last updated
.
Post not yet marked as solved
4 Replies
702 Views
Loading a video that played on tvOS 17, won't now play in tvOS 17.2. It isn't true for all videos or even all videos of a certain type. This code works fine on tvOS 17, but not on 17.2 import SwiftUI import AVKit struct ContentView: View { var body: some View { let player = AVPlayer(url: URL(string: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4")!) VideoPlayer(player: player) .onAppear { player.play() } } } I have tried reloading the metadata. I tried making the player from an AVAsset rather than a URL. I can't seem to see what is making it work with some videos and not all and what is different from tvOS 17 to 17.2.
Posted Last updated
.
Post not yet marked as solved
4 Replies
705 Views
I have a multiplatform app where I support iOS, macOS and tvOS. There is one target which supports it all. In my assets catalog I have the AppIcon entry which holds the app icon for iOS and macOS. This works as expected. However the tvOS app icon is ignored. I added an "tvOS App Icon & Top Shelf Image" asset to my asset catalog and filled it with my icons for tvOS. Then I added it in the target’s general settings App Icon entry under App Icons and Launch Screen like shown in the screenshot. What am I missing? What needs to be done to make this work?
Posted
by RayWo.
Last updated
.
Post not yet marked as solved
0 Replies
359 Views
It looks like there's a new tab bar / column style design for tvOS that was introduced with the current TV app. Is there any word on this being a developer available component?
Posted Last updated
.
Post not yet marked as solved
0 Replies
454 Views
when i am adding new view to replace viewcontroller's view like this : let viewcontroller: UIViewController! let rootview:UIView! viewcontroller = UIViewController () rootview = UIView (frame:viewcontroller.view.bounds) viewcontroller.view = rootview // Adding a button let button = UIButton(type: .system) button.setTitle("Tap Me", for: .normal) button.titleLabel?.font = UIFont.systemFont(ofSize: 18) button.addTarget(self, action: #selector(buttonTapped), for:.allEvents) viewcontroller.view.addSubview(button) For ios(iPhone/ipad) , i am able to get button click event . But in case of tvOS , i am not getting button click event. But in case of tvOS if use the default view of viewcontroller like this , i am getting button click events and things works fine: let viewcontroller: UIViewController! viewcontroller = UIViewController () // Adding a button let button = UIButton(type: .system) button.setTitle("Tap Me", for: .normal) button.titleLabel?.font = UIFont.systemFont(ofSize: 18) button.addTarget(self, action: #selector(buttonTapped), for:.allEvents) viewcontroller.view.addSubview(button) Is this some bug for tvOS or for tvOS this suppose to happen this way ?
Posted Last updated
.
Post not yet marked as solved
0 Replies
415 Views
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.
Posted Last updated
.
Post not yet marked as solved
0 Replies
563 Views
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.
Posted Last updated
.
Post marked as solved
3 Replies
568 Views
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?
Posted
by tbrass84.
Last updated
.
Post not yet marked as solved
0 Replies
338 Views
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) } } } }
Posted
by theta71.
Last updated
.