Post

Replies

Boosts

Views

Activity

Reply to NSRunningApplication activateWithOptions does not work on Sonoma
NSApplicationActivateIgnoringOtherApps is deprecated in Sonoma so it seems intentional. I understand the theory that forcing yourself active can be abused and bad but I've needed to do it to workaround macOS bugs before. I use NSApplication +activateIgnoringOtherApps: to workaround some bugs in macOS before...but that's also deprecated and I haven't tested but I assume that that method doesn't work either anymore. Curious why are you calling that inside an autoreleasepool?
Topic: UI Frameworks SubTopic: AppKit Tags:
Oct ’23
Reply to AVSpeechSynthesizer Broken on iOS 17
Yeah pretty much all you can do is wait. I filed a TSI and it got credited back and they said there is no workaround to the issue. I advise everyone impacted by this to file a Feedback with Apple which (hopefully) will cause them to treat the issue with a higher priority if they see it is affecting a lot of apps. I'm pretty sure every app using AVSpeechSynthesizer is broken on iOS 17.
Topic: Media Technologies SubTopic: Audio Tags:
Oct ’23
Reply to WKWebView on Mac Catalyst elementFullscreenEnabled set to YES on WKPreferences but it does not work
After looking into this a bit more it seems to be a Mac Catalyst issue. The HTML full screen API doesn't appear to be supported at all. If you load a page with Javascript that calls requestFullscreen on an element you will instead get a Javascript exception. You can confirm this with this simple little bit of javascript: // Function to open fullscreen mode. Attached to a button's onclick event. function openFullscreen() { //The elem is a <video> element. var elem = document.getElementById('myvidid'); if (elem.requestFullscreen) { console.log('Calling requestFullscreen'); elem.requestFullscreen(); } else if (elem.webkitRequestFullscreen) { console.log('Calling webkitRequestFullscreen'); elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { console.log('Calling msRequestFullscreen'); elem.msRequestFullscreen(); } else { console.log('Calling nothing. Must be Mac Catalyst.'); } } If I run it on iPad the following logs out: Calling requestFullscreen If I run it on Mac Catalyst (Optimized for Mac) the following logs out: Calling nothing. Must be Mac Catalyst. If I create an AppKit target and run it works. -- So full screen elements is just stripped out of Mac Catalyst. Doesn't matter if you set elementFullscreenEnabled on WKPreferences to YES. Hopefully it's a bug and not "intentional behavior" to make Catalyst apps less capable.
Topic: Safari & Web SubTopic: General Tags:
Oct ’23
Reply to TipUIPopoverViewController disables all the views from presenting screen
Try setting the passthroughViews property on TipUIPopoverViewController's popoverPresentationController https://developer.apple.com/documentation/uikit/uipopoverpresentationcontroller/1622312-passthroughviews?language=objc Include the view controller's view that you are presenting in the array. tipUIPopoverViewController.popoverPresentationController.passthroughViews = @[self.view]; //then present it. Unfortunately I can't test this myself because even though TipUIPopoverViewController is a view controller subclass for whatever reason they decided not to include a header file that can be imported into Objective-C which is just bizarre.
Topic: UI Frameworks SubTopic: UIKit Tags:
Oct ’23
Reply to WKWebView -requestMediaPlaybackStateWithCompletionHandler: Reporting Incorrect Playback State?
Guess I'm going to have to try to do it with Javascript which is going to be difficult because media is often placed in iframes and communicating with user scripts across frame boundaries properly is kind of difficult. Also is there a way I can execute a script (from the native app) on all frames (without knowing of the existence of iframes)? Ideally something like -evaluateJavaScriptInAllFrames:inContentWorld:perFrameResponseHander:completionHandler: I can install a user script on all frames but when the native app wants to manipulate something in a subframe (say from a UIButton press), it doesn't seem like I can get ahold of a WKFrameInfo describing the iframe outside of the WKScriptMessageHandler callback. or...Is there a place in AVFoundation where I can pick up WKWebview playback events to avoid using javascript?
Topic: Safari & Web SubTopic: General Tags:
Oct ’23
Reply to Implement preferences menu entry in MacCatalyst
As you discovered UIAction just takes a block with no keyboard shortcut support and UIKeyCommand takes a selector and has no ability to set a target (UIKeyCommand just goes through the responder chain). For a top level action like "Show Settings" invoked from the menu bar it seems silly to me that the entire responder chain needs to be enumerated but that's how they decided to implement it in Mac Catalyst. A NSMenuItem in AppKit world can specify a target but for whatever reason they made the context menu/menu bar APIs a little weird in UIKit/Mac Catalyst. I believe the AppDelegate is supposed to participate in the responder chain but don't think it does on Mac Catalyst which is why the menu bar item isn't validating. Add your showPreferences method on UIApplication in a Swift extension or Objective-C category instead (UIApplication is in the responder chain). So long as nothing else in your responder chain implements a selector that collides with that name the UIApplication should always get it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to WKWebView -requestMediaPlaybackStateWithCompletionHandler: Reporting Incorrect Playback State?
Breaking this down to a small sample project I get some strange results. Here's another example: The web view's configuration is set to: mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll; I set the navigation delegate. Then I load a page like macrumors.com/2023/10/09/video-of-prototype-touchscreen-imac-g3/ After the page loads the -webView:didFinishNavigation: method is called. It is implemented like this: #pragma mark - Navigation Delegate -(void)webView:(WKWebView*)webView didFinishNavigation:(null_unspecified WKNavigation*)navigation { NSLog(@"-webView:didFinishNavigation:"); [self.webView requestMediaPlaybackStateWithCompletionHandler:^(WKMediaPlaybackState playbackState) { NSString *playbackStateString = webKitPlaybackStateToString(playbackState); NSLog(@"Playback State: %@",playbackStateString); }]; } And WKMediaPlaybackStatePlaying logs out. There is a YouTube video on the page but it is not playing. I'm not sure if this "playback state" is referring to an animated ad or something but from what I can tell the page doesn't have any video or audio playback. Am I misunderstanding the meaning of WKMediaPlaybackState?
Topic: Safari & Web SubTopic: General Tags:
Oct ’23
Reply to Code-level support ticket usage
I don't speak for Apple but from my experience I usually get credited back the ticket if they think the issue I'm reporting is a system bug initially (before talking to an Apple engineer) and they don't think there is a workaround they can advise. For example I opened a TSI recently and I got an email "No workaround is available" and I got my TSI credited back. Sometimes they won't necessarily think your issue relates to a system bug but then after talking to an engineer they may realize it is. In these cases I don't think they will refund your ticket once you start communication with an engineer (but I'm just speaking on my own experience I have no idea what their official policy is). They may suggest a workaround in these cases (but may not have one to offer either). Then everything ends with you filing a Bug Report and you wait but in my experience none of my bugs ever got fixed and I never hear from them again.
Oct ’23
Reply to A Web Page's Javascript Causing an Error in My WKUserScript Loaded in a Custom Content World
Changing the Global variable from let to var fixed the error but I am still curious if this behavior is intended or would be considered a bug.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to NSRunningApplication activateWithOptions does not work on Sonoma
NSApplicationActivateIgnoringOtherApps is deprecated in Sonoma so it seems intentional. I understand the theory that forcing yourself active can be abused and bad but I've needed to do it to workaround macOS bugs before. I use NSApplication +activateIgnoringOtherApps: to workaround some bugs in macOS before...but that's also deprecated and I haven't tested but I assume that that method doesn't work either anymore. Curious why are you calling that inside an autoreleasepool?
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to AVSpeechSynthesizer Broken on iOS 17
Yeah pretty much all you can do is wait. I filed a TSI and it got credited back and they said there is no workaround to the issue. I advise everyone impacted by this to file a Feedback with Apple which (hopefully) will cause them to treat the issue with a higher priority if they see it is affecting a lot of apps. I'm pretty sure every app using AVSpeechSynthesizer is broken on iOS 17.
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to AVSpeechSynthesizer Broken on iOS 17
Another related thread: https://developer.apple.com/forums/thread/738048?answerId=768059022
Topic: Media Technologies SubTopic: Audio Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to WKWebView on Mac Catalyst elementFullscreenEnabled set to YES on WKPreferences but it does not work
After looking into this a bit more it seems to be a Mac Catalyst issue. The HTML full screen API doesn't appear to be supported at all. If you load a page with Javascript that calls requestFullscreen on an element you will instead get a Javascript exception. You can confirm this with this simple little bit of javascript: // Function to open fullscreen mode. Attached to a button's onclick event. function openFullscreen() { //The elem is a <video> element. var elem = document.getElementById('myvidid'); if (elem.requestFullscreen) { console.log('Calling requestFullscreen'); elem.requestFullscreen(); } else if (elem.webkitRequestFullscreen) { console.log('Calling webkitRequestFullscreen'); elem.webkitRequestFullscreen(); } else if (elem.msRequestFullscreen) { console.log('Calling msRequestFullscreen'); elem.msRequestFullscreen(); } else { console.log('Calling nothing. Must be Mac Catalyst.'); } } If I run it on iPad the following logs out: Calling requestFullscreen If I run it on Mac Catalyst (Optimized for Mac) the following logs out: Calling nothing. Must be Mac Catalyst. If I create an AppKit target and run it works. -- So full screen elements is just stripped out of Mac Catalyst. Doesn't matter if you set elementFullscreenEnabled on WKPreferences to YES. Hopefully it's a bug and not "intentional behavior" to make Catalyst apps less capable.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to No email notifications since a few days
Thanks for your reply Quinn. It was FB7830262. I also didn't get an e-mail notification for your reply on this thread even though I'm watching it.
Replies
Boosts
Views
Activity
Oct ’23
Reply to Programmatically Launch an macOS Action Extension?
I don't believe it is possible to do this programmatically using public API. I'm marking this as correct. If I'm mistaken feel free to reply and I'll take off the green check.
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to No email notifications since a few days
I haven't been getting e-mail notifications for some threads I'm following lately. Not sure why. I filed a bug on this three years ago which I forgot I even filed and it just got closed as "Works as Designed. We won't fix it." Sigh.
Replies
Boosts
Views
Activity
Oct ’23
Reply to WKWebView -resumeAllMediaPlayback: deprecated Replacement is -setAllMediaPlaybackSuspended:completionHandler:
I filed FB13273243
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to TipUIPopoverViewController disables all the views from presenting screen
Try setting the passthroughViews property on TipUIPopoverViewController's popoverPresentationController https://developer.apple.com/documentation/uikit/uipopoverpresentationcontroller/1622312-passthroughviews?language=objc Include the view controller's view that you are presenting in the array. tipUIPopoverViewController.popoverPresentationController.passthroughViews = @[self.view]; //then present it. Unfortunately I can't test this myself because even though TipUIPopoverViewController is a view controller subclass for whatever reason they decided not to include a header file that can be imported into Objective-C which is just bizarre.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to WKWebView -requestMediaPlaybackStateWithCompletionHandler: Reporting Incorrect Playback State?
Guess I'm going to have to try to do it with Javascript which is going to be difficult because media is often placed in iframes and communicating with user scripts across frame boundaries properly is kind of difficult. Also is there a way I can execute a script (from the native app) on all frames (without knowing of the existence of iframes)? Ideally something like -evaluateJavaScriptInAllFrames:inContentWorld:perFrameResponseHander:completionHandler: I can install a user script on all frames but when the native app wants to manipulate something in a subframe (say from a UIButton press), it doesn't seem like I can get ahold of a WKFrameInfo describing the iframe outside of the WKScriptMessageHandler callback. or...Is there a place in AVFoundation where I can pick up WKWebview playback events to avoid using javascript?
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Implement preferences menu entry in MacCatalyst
As you discovered UIAction just takes a block with no keyboard shortcut support and UIKeyCommand takes a selector and has no ability to set a target (UIKeyCommand just goes through the responder chain). For a top level action like "Show Settings" invoked from the menu bar it seems silly to me that the entire responder chain needs to be enumerated but that's how they decided to implement it in Mac Catalyst. A NSMenuItem in AppKit world can specify a target but for whatever reason they made the context menu/menu bar APIs a little weird in UIKit/Mac Catalyst. I believe the AppDelegate is supposed to participate in the responder chain but don't think it does on Mac Catalyst which is why the menu bar item isn't validating. Add your showPreferences method on UIApplication in a Swift extension or Objective-C category instead (UIApplication is in the responder chain). So long as nothing else in your responder chain implements a selector that collides with that name the UIApplication should always get it.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to WKWebView -requestMediaPlaybackStateWithCompletionHandler: Reporting Incorrect Playback State?
I filed FB13265380
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to WKWebView -requestMediaPlaybackStateWithCompletionHandler: Reporting Incorrect Playback State?
Breaking this down to a small sample project I get some strange results. Here's another example: The web view's configuration is set to: mediaTypesRequiringUserActionForPlayback = WKAudiovisualMediaTypeAll; I set the navigation delegate. Then I load a page like macrumors.com/2023/10/09/video-of-prototype-touchscreen-imac-g3/ After the page loads the -webView:didFinishNavigation: method is called. It is implemented like this: #pragma mark - Navigation Delegate -(void)webView:(WKWebView*)webView didFinishNavigation:(null_unspecified WKNavigation*)navigation { NSLog(@"-webView:didFinishNavigation:"); [self.webView requestMediaPlaybackStateWithCompletionHandler:^(WKMediaPlaybackState playbackState) { NSString *playbackStateString = webKitPlaybackStateToString(playbackState); NSLog(@"Playback State: %@",playbackStateString); }]; } And WKMediaPlaybackStatePlaying logs out. There is a YouTube video on the page but it is not playing. I'm not sure if this "playback state" is referring to an animated ad or something but from what I can tell the page doesn't have any video or audio playback. Am I misunderstanding the meaning of WKMediaPlaybackState?
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Code-level support ticket usage
I don't speak for Apple but from my experience I usually get credited back the ticket if they think the issue I'm reporting is a system bug initially (before talking to an Apple engineer) and they don't think there is a workaround they can advise. For example I opened a TSI recently and I got an email "No workaround is available" and I got my TSI credited back. Sometimes they won't necessarily think your issue relates to a system bug but then after talking to an engineer they may realize it is. In these cases I don't think they will refund your ticket once you start communication with an engineer (but I'm just speaking on my own experience I have no idea what their official policy is). They may suggest a workaround in these cases (but may not have one to offer either). Then everything ends with you filing a Bug Report and you wait but in my experience none of my bugs ever got fixed and I never hear from them again.
Replies
Boosts
Views
Activity
Oct ’23