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
798
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
953
Jan ’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
947
Feb ’24
Can I schedule multi print jobs parallelly in ios using UIPrintInteractionController?
For printing from worker thread to a UIPrinter(whose url i have saved ) i am doing this and able to print : func PrintPdfDocument (pDocument:Data) { // Create a print interaction controller let printController = UIPrintInteractionController.shared // Set the printing options let printInfo = UIPrintInfo(dictionary:nil) printInfo.jobName = "Print Job " printController.printInfo = printInfo printController.showsPageRange = true // Set the PDF document to be printed printController.printingItems = pDocument printController.print(to: defaulttprinter, completionHandler: { (controller, completed, error) in if completed { print("Printing successful!") } else { if let error = error { print("Printing failed with error: \(error.localizedDescription)") } else { print("Printing was canceled.") } } }) } When i call PrintPdfDocument (pDocument:Data) function , more than once with diffrent data shown below : DispatchQueue.global().async { PrintPdfDocument (pDocument:data1) } DispatchQueue.global().async { PrintPdfDocument (pDocument:data2) } DispatchQueue.global().async { PrintPdfDocument (pDocument:data3) } Printer is printing only one document(data1) . For other call is not executing printController.print (to....) function inside PrintPdfDocument.
0
0
859
Feb ’24
Best Way to Help Users Diagnose iOS App Crashes with No UI Feedback
Hi all, We're working on an iOS application and would like to improve our ability to diagnose failures - especially in scenarios where the app crashes before it can present any UI to the user. A few specific questions: In case of an exception or crash, is there a way to log the issue so the user (or our support team) can understand the cause of the failure? If the app crashes abruptly (e.g., due to a runtime exception or crash during launch), is there a recommended way to persist error information before the process terminates? Are there Apple-supported mechanisms (like crash reporting tools or APIs) we can integrate that would help us capture such issues? What’s the best practice for enabling support teams to assist users based on crash reports - especially for crashes that happen before any user interaction? Our goal is to make sure users aren't left in the dark if the app fails to start, and to allow us to deliver timely updates or support based on the cause of the crash. Thanks in advance for your guidance!
Topic: UI Frameworks SubTopic: General Tags:
0
0
90
May ’25