tvOS is the operating system for Apple TV.

Posts under tvOS tag

111 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

[tvOS] ScrollView with Text does not scroll
I'm trying to do something so seemingly basic, yet I can't get it to work and I'm flummoxed. In a basic, vanilla SwiftUI app for tvOS, embed a single Text element with a very long string (hundreds of lines) in it: struct ContentView: View { var body: some View { ScrollView(.vertical) { Text(veryLargeString) .focusable() } } } Then fire up the app on tvOS, and it will not scroll. No matter what I do. Pressing arrow keys, swiping fast with my thumb, and nothing. It will not move. Ironically, in the Xcode SwiftUI Preview window—it does scroll, so that's always a fun tease. What I do know is that the focus engine is throwing a few errors, so it's leading me to believe the issue is with how I have the focusable element attached. I'm using a combination of -UIFocusLoggingEnabled YES as well as listening for UIFocusSystem.movementDidFailNotification. Unfortunately since this is SwiftUI, the notification failure and debugging logs aren't really all that actionable. Help appreciated!
1
1
665
Mar ’24
Apple TV won’t connect to my external surround sound speakers
I know that this is not a coding question and I have posted on the regular Apple Forum and have been working with the 800 Tech Support folk for 4 months. I am in a world of hurt. Have ATV + Samsung TV + external soundbar. All software versions are current NO Cable box (direct input). 4 months ago I had Cable box = zero problems. With Samsung on and ATV off, stereo = Dolby 5.1 sounds great. With ATV also on, no stereo. I can use Siri remote to activate stereo until I change to a new movie. ATV then reverts to mono = PCM One Tech Support lady said to just not watch multiple movie. ?$@!*+^? I have spoken with engineers at Samsung and Sonos (soundbar). Both say my cabling is correct = 1 cable from soundbar to HDMI Arc on TV + 1 cable from ATV to another HDMI port on TV. Another Tech Support folk said to connect ATV to soundbar. Soundbars don’t have gobs of HDMI ports, the TV does. ?!$@*^+%# I have spoken with Apple Tech Support with zero help for 3-4 months. I think I have been a good soldier. But it is time for real results. Please help
1
0
566
Apr ’24
Universal Link Not working for Netflix
I am trying to Execute Universal Link of Netflix show from My App in tvOS 17.2 When I Call the open(_:options:completionHandler:) to execute the Link it does open the Netflix App but open the landing page of Title. I have tried different alternative links but all has same behaviour. The same Link works in iOS ans iPad OS. Here the links that I have tried and the code that handles the universal Link. http://www.netflix.com/title/81731618 nflx://www.netflix.com/title/81731618 // Handle remote notification here // For example, extract deep link and perform appropriate action if let deepLink = userInfo["deep_link_key"] as? String { // Handle the deep link here print("Received Deep Link: \(deepLink)") if let url = URL(string: deepLink) { UIApplication.shared.open(url) } } }
0
0
553
Feb ’24
Parental Controls in SwiftUI on tvOS
How to implement Player in SwiftUI with support for parental controls? Sample Code: Working with Overlays and Parental Controls in tvOS I use AVPlayerViewController in SwiftUI. On cancel, rejecting the request, the screen is black. On change the channel, on move command up or down direction, I am replacing the current player item with new. Status is ready to play, status of the request is successful upon replacement and I set player to play. The screen is still black.
0
0
524
Feb ’24
Handling tvOS Siri remote + iOS remote + Nimbus/PS
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?
0
0
667
Feb ’24
Apple TV 4K (HDMI + WIFI ONLY) cannot prepare into MDM
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.
0
0
668
Feb ’24
tvOS AVPlayer - Any way to stop video playback & downloading and keep audio?
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
0
0
467
Feb ’24
Getting Swift_header compilation error for tvOS
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
0
2
542
Feb ’24
tvOS - inputView on UITextfield does not work
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
0
0
462
Feb ’24
Better way to exit the tvOS app.
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."
2
0
557
Jan ’24
Can not build project with FMOD for Unreal 2.0.2.20 for iOS Simulator - Error “building for iOS Simulator, but linking in object file built for iOS”
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
0
0
376
Jan ’24
tvOS icon missing layers
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.
3
0
807
Jan ’24
Xcode: Generating a profile without a real Apple TV device?
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?
2
0
563
Jan ’24
AVPlayer not Playing on tvOS 17.2
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.
5
1
900
Jan ’24
event handler for button click not getting triggered
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 ?
0
0
546
Jan ’24