I found a memory leak in tvOS 17.4, but it's not happening in tvOS 18.0
here is the code flow
1.I have controller inside which I have tableView which in turn contains a collectionview
here I have passed self to tableViewcell as delegate and then from tableview cell I have passed self again as delegate to collectionViewcell, but memory is not released, because self is retained
"I have passed self as weak every where still memory leak is happening only in tvOS 17.4 and below versions. but in 18.0 and above versions it's fine"
Posts under Apple TV tag
22 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Description
I'm developing a tvOS application where I utilize a UISearchController embedded within a UISearchContainerViewController for search functionality. In a particular flow, a custom view controller contains a TVDigitEntryViewController as a child, with its modalPresentationStyle set to .blurOverFullScreen. The issue arises when a user initiates the PIN entry but decides to cancel and return to the search interface without entering a PIN. Upon returning, the search keyboard is no longer visible, and attempts to focus or interact with it are unsuccessful.
Steps to Reproduce
Initialize and present a UISearchContainerViewController that contains a UISearchController with a results view controller.
Within the search results, present a custom view controller containing TVDigitEntryViewController as a child, setting its modalPresentationStyle to .blurOverFullScreen.
Dismiss the custom view controller without entering a PIN (e.g., by pressing the Menu button on the remote).
Observe that upon returning to the search interface, the keyboard is missing, and focus interactions are unresponsive.
Observed Behavior
After dismissing the custom view controller with TVDigitEntryViewController, the search keyboard does not reappear, and the focus system seems to lose track of the search input field.
Expected Behavior
The search keyboard should remain visible and functional after dismissing the custom view controller, allowing users to continue their search without interruption.
Additional Context
I have reviewed the TVDigitEntryViewController documentation (developer.apple.com) and related discussions on the Apple Developer Forums but have not found a solution to this specific issue.
Questions
Has anyone encountered a similar issue or have insights into why the search keyboard becomes unresponsive after dismissing a .blurOverFullScreen modal with a child TVDigitEntryViewController?
Are there recommended practices to ensure the search keyboard remains active and focusable after such modal presentations?
Any guidance or suggestions would be greatly appreciated. Thank you!
I'm working on an Apple TVOS app and trying to upload it to the App Store. My app includes a video file that’s 8GB in size, and I’ve moved the video to On-Demand Resources to optimize its size. However, when I generate the archive, the total file size comes out to 8.4GB, which is too large for App Store submission.
Uploaded the build in the test flight but the test flight build is in progress then got the error is an invalid build.
How to upload a large build of Apple TV in the App Store using on-demand resources.
on-demand video size is 8GB
I'm working on an Apple TVOS app and trying to upload it to the App Store. My app includes a video file that’s 8GB in size, and I’ve moved the video to On-Demand Resources to optimize its size. However, when I generate the archive, the total file size comes out to 8.4GB, which is too large for App Store submission.
Uploaded the build in the test flight but the test flight build is in progress then got the error is an invalid build.
How to upload a large build of Apple TV in the App Store using on-demand resources.
on-demand video size is 8GB
Hello, we have HLS Stream app on Apple TV. Our streams are DRM protected. We have problem with streams when source device is turned off. For example, user start to watch our HLS DRM Protected content. After some time, user turns off device (it can be Monitor or TV via connected HDMI). Our app does not understand HDMI Source device turned off. Is there any way to understand HDMI connected device is turned off on Swift?
A new app I have submitted to Apple App Review for iOS/tvOS/macOS has been rejected for tvOS because it is apparently crashing on launch. The same build has been approved by App Review for iOS and macOS.
So far, App Review have not provided me with a crash report, and despite a lot of trying, I cannot get the crash to occur either on a real device or on any version of the Apple TV in the simulator.
Apart from constantly asking App Review for the crash report, I don't know how to resolve this, and that means I either have to give up on tvOS for this app, delay the launch, or perhaps start another submission and get lucky with a different reviewer that doesn't experience the crash (but then what if lots of users do?).
I've tried running a release build on my devices and the simulator; but I'm not sure how I'm supposed to debug this without a crash to work with. The TestFlight build for the same upload that is crashing for App Review works just fine.
Any suggestions would be welcome.
When I open Iplaytv on my Apple TV it says refresh needed but I don’t know how
I recently tried Apple TV after using android tv for a long time.
The main missing item is having a browser. I could not find one.
i tried building Firefox for TVOS, it failed with WebKit not available.
Is there a way to build WebKit and package it along with a browser package while building it?
When you launch Xcode and then open Devices and Simulators, and connect your Apple TV 4K, you have a new menu item in Settings named Developer. If you close Xcode, the item stays, but if you restart the Apple TV 4K, it's gone until the next time you open Xcode and pair it again.
Is there a way to leave it there permanently? I'm not a developer, but it's still useful to me because it has the playback HUD with lots of information about the codecs, streaming bitrate and so on, and since I'm an A/V nerd, that is quite useful to me.
I am encountering an issue when making an API call using URLSession with DispatchQueue.global(qos: .background).async on a real device running tvOS 18. The code works as expected on tvOS 17 and in the simulator for tvOS 18, but when I remove the debug mode, After the API call it takes few mintues or 5 to 10 min to load the data on the real device.
Code: Here’s the code I am using for the API call:
appconfig.getFeedURLData(feedUrl: feedUrl, timeOut: kRequestTimeOut, apiMethod: ApiMethod.POST.rawValue) { (result) in
self.EpisodeItems = Utilities.sharedInstance.getEpisodeArray(data: result)
}
func getFeedURLData(feedUrl: String, timeOut: Int, apiMethod: String, completion: @escaping (_ result: Data?) -> ()) {
guard let validUrl = URL(string: feedUrl) else { return }
var request = URLRequest(url: validUrl, cachePolicy: .useProtocolCachePolicy, timeoutInterval: TimeInterval(timeOut))
let userPasswordString = "\(KappSecret):\(KappPassword)"
let userPasswordData = userPasswordString.data(using: .utf8)
let base64EncodedCredential = userPasswordData!.base64EncodedString(options: .lineLength64Characters)
let authString = "Basic \(base64EncodedCredential)"
let headers = [
"authorization": authString,
"cache-control": "no-cache",
"user-agent": "TN-CTV-\(kPlateForm)-\(kAppVersion)"
]
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpMethod = apiMethod
request.allHTTPHeaderFields = headers
let response = URLSession.requestSynchronousData(request as URLRequest)
if response.1 != nil {
do {
guard let parsedData = try JSONSerialization.jsonObject(with: response.1!, options: .mutableContainers) as? AnyObject else {
print("Error parsing data")
completion(nil)
return
}
print(parsedData)
completion(response.1)
return
} catch let error {
print("Error: \(error.localizedDescription)")
completion(response.1)
return
}
}
completion(response.1)
}
import Foundation
public extension URLSession {
public static func requestSynchronousData(_ request: URLRequest) -> (URLResponse?, Data?) {
var data: Data? = nil
var responseData: URLResponse? = nil
let semaphore = DispatchSemaphore(value: 0)
let task = URLSession.shared.dataTask(with: request) { taskData, response, error in
data = taskData
responseData = response
if data == nil, let error = error {
print(error)
}
semaphore.signal()
}
task.resume()
_ = semaphore.wait(timeout: .distantFuture)
return (responseData, data)
}
public static func requestSynchronousDataWithURLString(_ requestString: String) -> (URLResponse?, Data?) {
guard let url = URL(string: requestString.checkValidUrl()) else { return (nil, nil) }
let request = URLRequest(url: url)
return URLSession.requestSynchronousData(request)
}
}
Issue Description: Working scenario: The API call works fine on tvOS 17 and in the simulator for tvOS 18. Problem: When running on a real device with tvOS 18, the API call takes time[enter image description here] when debug mode is disabled, but works fine when debug mode is enabled, Data is loading after few minutes.
Error message: Error Domain=WKErrorDomain Code=11 "Timed out while loading attributed string content" UserInfo={NSLocalizedDescription=Timed out while loading attributed string content} NSURLConnection finished with error - code -1001 nw_read_request_report [C4] Receive failed with error "Socket is not connected" Snapshot request 0x30089b3c0 complete with error: <NSError: 0x3009373f0; domain: BSActionErrorDomain; code: 1 ("response-not-possible")> tcp_input [C7.1.1.1:3] flags=[R] seq=817957096, ack=0, win=0 state=CLOSE_WAIT rcv_nxt=817957096, snd_una=275546887
Environment: Xcode version: 16.1 Real device: Model A1625 (32GB) tvOS version: 18.1
Debugging steps I’ve taken: I’ve verified that the issue does not occur in debug mode. I’ve confirmed that the API call works fine on tvOS 17 and in the simulator (tvOS 18). The error suggests a network timeout (-1001) and a socket connection issue ("Socket is not connected").
Questions:
Is this a known issue with tvOS 18 on real devices? Are there any specific settings or configurations in tvOS 18 that could be causing the timeout error in non-debug mode? Could this be related to how URLSession or networking behaves differently in release mode? I would appreciate any help or insights into this issue!
When the native info panel (which displays the title, subtitle, description, and custom buttons) opens, the focus immediately shifts to the first button. As a result, VoiceOver skips the description, which is crucial for users relying on accessibility features.
I haven’t found a way to detect when it opens. Knowing this would allow me to trigger custom VoiceOver announcements or adjust the focus order dynamically.
Are any other people experiencing this issue, and how do we solve it?
When adding more than 7 items, the Tab bar wiggles or may not reappear when switching back to it. Is this a bug? or could this be a problem with focus management? or any other cause?
Tried sample code https://developer.apple.com/documentation/swiftui/enhancing-your-app-content-with-tab-navigation
On testing my app with tvOS 18, I have noticed the Siri Remote back button no longer provides system-provided behavior when interacting with tab bar controller pages. Instead of moving focus back to the tab bar when pressed, the back button will close the app, as if the Home button was pressed. This occurs both on device and in the Simulator.
Create tvOS project with a tab bar controller.
Create pages/tabs which contain focusable items (ie. buttons)
Scroll down to any focusable item (ie. a button or UICollectionView cell)
Hit the Siri Remote back button. See expect behavior below:
Expected behavior: System-provided behavior should move focus back to the tab bar at the top of the screen.
Actual results: App is closed and user is taken back to the Home Screen.
Has anyone else noticed this behavior?
Model: Apple TV 4K (3rd generation) Wi-Fi & Ethernet 128GB
I am an Apple Systems Admin for a school district. A contractor working on new buildings/upgrades for us purchased Apple TVs outside of our Apple account.
When attempting to add these Apple TVs to Apple School Manager and enroll them into our MDM (via Apple Configurator 2 version 2.17), i'm running into a few problems.
When inputting the Pair Code:
-Says “Pairing Failed (-402653161)”--this error code only takes me to Apple Forums that end up answerless
-But device still shows up under Paired Devices and in Configurator
On Step 3 of 4 when “Preparing Apple TV—Activating TVOS”
-An unexpected error has occurred with “Apple TV”.
The device is not connected. [ConfigurationUtilityKit.error – 0x25B (603)]--this error code also only points me to Apple Forums for Configurator problems regarding iPads
-only option is “Stop”
-Appears that Configurator is still working in the background
Click Stop (as it is my only option), then Apple TV then disappears from Configurator.
Devices appear to be wiping OS/reinstalling OS and then going back to factory default settings. They are not being added to our ASM account.
Any ideas?
I'm creating a Netflix like app on tvOS, here is my compositional layout that I use with my collectionView.
private func createLayout() -> UICollectionViewCompositionalLayout {
return UICollectionViewCompositionalLayout { (section, _) -> NSCollectionLayoutSection? in
// item
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1),
heightDimension: .fractionalHeight(1.0))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
item.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 10, bottom: 0, trailing: 10)
// group
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1/5),
heightDimension: .estimated(350))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])
// section
let section = NSCollectionLayoutSection(group: group)
section.orthogonalScrollingBehavior = .groupPaging
let headerSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0),
heightDimension: .estimated(UIFont(name: "MyFont", size: 36)!.lineHeight))
let sectionHeader = NSCollectionLayoutBoundarySupplementaryItem(
layoutSize: headerSize,
elementKind: "SectionHeader",
alignment: .top)
section.boundarySupplementaryItems = [sectionHeader]
section.contentInsets = NSDirectionalEdgeInsets(top: 0, leading: 20, bottom: 30, trailing: 0)
return section
}
}
So:
My collection view is composed by several row (that are the sections).
Each section is composed by groups containing 1 item each.
Each section can be scrolled horizontally.
And you can scroll vertically to move from a section to an other.
I'm expecting to have the following behavior when scrolling: Horizontal scrolling:
Before focus shifts
--------------------------
| vA vB vC vD vE |
| [v1] v2 v3 v4 v5 |
| vU vW vX vY vZ |
--------------------------
After focus shifts
--------------------------
| vA vB vC vD vE |
| [v2] v3 v4 v5 v6 |
| vU vW vX vY vZ |
--------------------------
Vertical scroll:
Before focus shifts
--------------------------
| [vA] vB vC vD vE |
| v1 v2 v3 v4 v5 |
| vU vW vX vY vZ |
--------------------------
After focus shifts
--------------------------
| [v1] v2 v3 v4 v5 |
| vU vW vX vY vZ |
| vF vG vH vI vJ |
--------------------------
Thanks to section.orthogonalScrollingBehavior = .groupPaging the horizontal scrolling is working as expected. (I've put 1 item per group to achieve this)
But I'm going crazy with the vertical scroll, I'm not able to achieve it as expected, the focused section still centered verticaly on the screen ! What I'm getting:
Before focus shifts
--------------------------
| [vA] vB vC vD vE |
| v1 v2 v3 v4 v5 |
| vU vW vX vY vZ |
--------------------------
After focus shifts
--------------------------
| vA vB vC vD vE |
| [v1] v2 v3 v4 v5 |
| vU vW vX vY vZ |
--------------------------
After an other focus shifts
--------------------------
| v1 v2 v3 v4 v5 |
| [vU] vW vX vY vZ |
| vF vG vH vI vJ |
--------------------------
I've tried to play with the didUpdateFocusIn function without success
func collectionView(_ collectionView: UICollectionView, didUpdateFocusIn context: UICollectionViewFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
if let nextFocusedItemIndexPath = context.nextFocusedIndexPath {
let section = nextFocusedItemIndexPath.section
let sectionIndexPath = IndexPath(item: 0, section: section)
collectionView.scrollToItem(at: sectionIndexPath, at: .top, animated: true)
}
}
The collectionview is behaving strangely when using the didUpdateFocusIn function and I feel it's not the good way to perform what I'm expecting...
I've also try to play with the scrollViewWillEndDragging function without success
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset:
}
Everything that I tried looks like a hack and I can't believe Apple has not plan something for this use case, which is in my sense a common use case....
Hi,
I'm having a small App in the AppleTV-Simulator which is supposed to use the Siri-Remotes Swipe-Gesture.
It works perfect on the real device but on the simulator the Swipe-Gesture is not recognized in the App but it works on the Start-Screen of the Simulator using the simulated Siri-Remote app.
Here is the code which sets up the xAxis ans yAxis value change handlers:
#if targetEnvironment(simulator)
// Simulator
let siriRemote = GCController.controllers().filter { controller in
if controller.vendorName == "Gamepad" {
return true
} else {
return false
}
}
let sController = siriRemote.first!
let inputProfile = sController.physicalInputProfile
let dPad = inputProfile.dpads["Direction Pad"]
self.dPad = dPad
self.dPad!.xAxis.valueChangedHandler = self.directionPadXAxisValueChangeHandler
self.dPad!.yAxis.valueChangedHandler = self.directionPadYAxisValueChangeHandler
}
#else
// Device
if let _ = ( notification.object as? GCController)?.microGamepad {
let microProfileController = notification.object as! GCController
self.microGamePad = microProfileController.microGamepad
self.dPad = self.microGamePad!.dpad
self.dPad!.xAxis.valueChangedHandler = self.directionPadXAxisValueChangeHandler
self.dPad!.yAxis.valueChangedHandler = self.directionPadYAxisValueChangeHandler
}
#endif
Any help is greatly appreciated.
Cheers,
Frank
Hi Team,
I'm using AVPlayer on Apple TV 2nd generation which has that siri click pad with four buttons around and we need to detect where the user clicked on the Siri remote fast forward/backward. I have tested many different approaches to do it, but nothing is working for me.
Does anyone have any idea how to resolve it in Swift?
I'm developing an Apple TV OS app using SwiftUI. I'm encountering an issue with the color of the tab item. I want the color of the tab item to turn green when focused; for instance, when the tab item is selected, its background color should be green. Below is my current code, but it's not working. I've tried several other approaches, but none have worked.
struct ContentView: View {
@State private var selectedTab = 0
var body: some View {
ZStack(alignment: .topLeading){
TabView(selection: $selectedTab) {
HomeView()
.tabItem {
AppColors.gradientColor1
Label("Home", image: "home-dash")
}
.tag(0)
ProductsView()
.tabItem {
Label("Products", image: "open box-search")
}
.tag(1)
SearchView()
.tabItem {
Label("Search", image: "search")
}
.tag(2)
}
.accentColor(Color.green)
.background(.black)
Image("amazontabbarlogo")
}
}
}
I have internet inside but 5G outside. The Apple TV device responds to INTERNET only, not 56. So why not have an autodetect?
I would like a feature on the remote app which visualizes the TV screen in the remote app on the phone.
Scenario is to navigate the Apple TV while I’m not in front of the TV screen (e.g. start a show on Apple tv) Today I need to stand in front of the TV to see where I’m navigating to.