Post

Replies

Boosts

Views

Created

JavaScript Not Executing in WebView When Modally Presenting UIViewController on iOS 17.5.1
Issue Summary: I have encountered an issue where JavaScript does not execute in a WebView when another UIViewController is presented modally with modalPresentationStyle.fullScreen. This problem only occurs on physical devices running iOS 17.5.1. The issue is not present on iOS 17.5 simulators or devices running iOS 17.4.1 or earlier. Reproduction Steps: Create a ViewController with a WebView. Load a web page (e.g., https://apple.com) in the WebView. Present another ViewController modally with modalPresentationStyle.fullScreen. Verify that JavaScript execution in the initial WebView stops working. Test Code: import UIKit import WebKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Set up the WebView let configuration = WKWebViewConfiguration() let webView = WKWebView(frame: view.frame, configuration: configuration) view.addSubview(webView) webView.frame = view.frame if #available(iOS 16.4, *) { webView.isInspectable = true } else { // Fallback on earlier versions } webView.load(URLRequest(url: URL(string: "https://apple.com")!)) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let navigationController = UINavigationController(rootViewController: TargetViewController()) navigationController.modalPresentationStyle = .fullScreen present(navigationController, animated: true) } } class TargetViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Set up the WebView let webView = WKWebView(frame: view.frame, configuration: WKWebViewConfiguration()) view.addSubview(webView) webView.frame = view.frame if #available(iOS 16.4, *) { webView.isInspectable = true } else { // Fallback on earlier versions } webView.load(URLRequest(url: URL(string: "https://apple.com")!)) } } Observations: The JavaScript within the WebView stops executing only on physical devices running iOS 17.5.1. This issue does not occur on the iOS 17.5 simulator. Devices running iOS 17.4.1 or earlier do not experience this issue. Request for Assistance: Could you please provide any insights or potential workarounds for this issue? Additionally, if this is a known bug, any information on upcoming fixes would be highly appreciated. Thank you.
3
0
1.9k
Jun ’24
No longer invalidateIntrinsicContentSize() invokes intrinsicContentSize for UICollectionViewCell/UITableViewCell in iOS 16?
I've used invalidateIntrinsicContentSize() in UICollectionViewCell to calculate custom UI. But it doesn't invoke intrinsicContentSize on iOS beta 16 devices.. class DynamicCell: UICollectionViewCell { func invokeResize() { cell.subviews.forEach { $0.resize() } // it doesn't invoke intrinsicContentSize from iOS 16 beta ?? invalidateIntrinsicContentSize() } override func intrinsicContentSize: CGSize { return calculateDynamicCellSize() } } I don't know if it is a bug or a specification that occurred while implementing UICollectionView.selfSizingInvalidation property. I could revise this code for iOS beta 16 using parent's( UICollectionReusableView | UIView ) methods like below. class RevisedDynamicCell: UICollectionViewCell { func invokeResize() { cell.subviews.forEach { $0.resize() } if #available(iOS 16.0, *) { // It works because it called UIView.invalidateIntrinsicContentSize invalidateUIViewIntrinsicContentSize() } else { invalidateIntrinsicContentSize() } } override func intrinsicContentSize: CGSize { return calculateDynamicCellSize() } } extension UICollectionReusableView { func invalidateUIViewIntrinsicContentSize() { super.invalidateIntrinsicContentSize() } }```
1
0
1.9k
Jun ’22
AppDelegate applicationSignificantTimeChange runs before didFinishLaunchingWithOptions gets executed
In AppDelegate, I made several dependency injections in didFinishLaunchWithOptions, because I'm sure it is be first to call by AppDelegate. But I found that the app crashed several times because some DIs in applicationSignificantTimeChange are not set. (I could check it in Firebase Crashlytics.) Is it possible the app calls applicationSignificantTimeChange before didFinshLaunchWithOptions? Are there any other methods in AppDelegate that are called before didFinishLaunchWithOptions? (
0
0
632
Aug ’21
JavaScript Not Executing in WebView When Modally Presenting UIViewController on iOS 17.5.1
Issue Summary: I have encountered an issue where JavaScript does not execute in a WebView when another UIViewController is presented modally with modalPresentationStyle.fullScreen. This problem only occurs on physical devices running iOS 17.5.1. The issue is not present on iOS 17.5 simulators or devices running iOS 17.4.1 or earlier. Reproduction Steps: Create a ViewController with a WebView. Load a web page (e.g., https://apple.com) in the WebView. Present another ViewController modally with modalPresentationStyle.fullScreen. Verify that JavaScript execution in the initial WebView stops working. Test Code: import UIKit import WebKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Set up the WebView let configuration = WKWebViewConfiguration() let webView = WKWebView(frame: view.frame, configuration: configuration) view.addSubview(webView) webView.frame = view.frame if #available(iOS 16.4, *) { webView.isInspectable = true } else { // Fallback on earlier versions } webView.load(URLRequest(url: URL(string: "https://apple.com")!)) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let navigationController = UINavigationController(rootViewController: TargetViewController()) navigationController.modalPresentationStyle = .fullScreen present(navigationController, animated: true) } } class TargetViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Set up the WebView let webView = WKWebView(frame: view.frame, configuration: WKWebViewConfiguration()) view.addSubview(webView) webView.frame = view.frame if #available(iOS 16.4, *) { webView.isInspectable = true } else { // Fallback on earlier versions } webView.load(URLRequest(url: URL(string: "https://apple.com")!)) } } Observations: The JavaScript within the WebView stops executing only on physical devices running iOS 17.5.1. This issue does not occur on the iOS 17.5 simulator. Devices running iOS 17.4.1 or earlier do not experience this issue. Request for Assistance: Could you please provide any insights or potential workarounds for this issue? Additionally, if this is a known bug, any information on upcoming fixes would be highly appreciated. Thank you.
Replies
3
Boosts
0
Views
1.9k
Activity
Jun ’24
No longer invalidateIntrinsicContentSize() invokes intrinsicContentSize for UICollectionViewCell/UITableViewCell in iOS 16?
I've used invalidateIntrinsicContentSize() in UICollectionViewCell to calculate custom UI. But it doesn't invoke intrinsicContentSize on iOS beta 16 devices.. class DynamicCell: UICollectionViewCell { func invokeResize() { cell.subviews.forEach { $0.resize() } // it doesn't invoke intrinsicContentSize from iOS 16 beta ?? invalidateIntrinsicContentSize() } override func intrinsicContentSize: CGSize { return calculateDynamicCellSize() } } I don't know if it is a bug or a specification that occurred while implementing UICollectionView.selfSizingInvalidation property. I could revise this code for iOS beta 16 using parent's( UICollectionReusableView | UIView ) methods like below. class RevisedDynamicCell: UICollectionViewCell { func invokeResize() { cell.subviews.forEach { $0.resize() } if #available(iOS 16.0, *) { // It works because it called UIView.invalidateIntrinsicContentSize invalidateUIViewIntrinsicContentSize() } else { invalidateIntrinsicContentSize() } } override func intrinsicContentSize: CGSize { return calculateDynamicCellSize() } } extension UICollectionReusableView { func invalidateUIViewIntrinsicContentSize() { super.invalidateIntrinsicContentSize() } }```
Replies
1
Boosts
0
Views
1.9k
Activity
Jun ’22
AppDelegate applicationSignificantTimeChange runs before didFinishLaunchingWithOptions gets executed
In AppDelegate, I made several dependency injections in didFinishLaunchWithOptions, because I'm sure it is be first to call by AppDelegate. But I found that the app crashed several times because some DIs in applicationSignificantTimeChange are not set. (I could check it in Firebase Crashlytics.) Is it possible the app calls applicationSignificantTimeChange before didFinshLaunchWithOptions? Are there any other methods in AppDelegate that are called before didFinishLaunchWithOptions? (
Replies
0
Boosts
0
Views
632
Activity
Aug ’21