Post

Replies

Boosts

Views

Activity

WebAVPlayerController valueForUndefinedKey:]: this class is not key value coding-compliant for the key coordinatedPlaybackActive.
When playing a video in WKWebView I get this exception thrown after playing a video in "Full window mode" (that is when video takes over the size of the window, not to be confused with "full screen mode"). I'm running on Mac Catalyst. #1 0x0000000188855800 in -[NSException raise] () #2 0x0000000189c2170c in -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] () #3 0x000000018968db9c in -[NSObject(NSKeyValueCoding) valueForKey:] () #4 0x000000018968da04 in -[NSObject(NSKeyValueCoding) valueForKeyPath:] () #5 0x00000001b9709a10 in -[AVPlaybackControlsController _observeBoolForKeyPath:usingKeyValueObservationController:observationHandler:] () #6 0x00000001b97066a8 in -[AVPlaybackControlsController _startObservingForPlaybackViewUpdates] () #7 0x00000001b9708ad4 in -[AVPlaybackControlsController _updatePlaybackControlsVisibleAndObservingUpdates] () #8 0x00000001b96db568 in __81-[AVPlayerViewController transitionController:willBeginPresentingViewController:]_block_invoke () #9 0x00000001b290f3ec in -[_UIViewControllerTransitionCoordinator _applyBlocks:releaseBlocks:] () #10 0x00000001b28e01cc in -[_UIViewControllerTransitionContext _runAlongsideCompletions] () #11 0x00000001b28df984 in -[_UIViewControllerTransitionContext completeTransition:] () #12 0x00000001b972300c in __35-[AVTransition completeTransition:]_block_invoke () #13 0x00000001b96da368 in -[AVPlayerViewController transitionController:transitionWillComplete:continueBlock:] () #14 0x00000001b9736448 in -[AVTransitionController transitionWillComplete:success:continueBlock:] () #15 0x00000001b9722e44 in -[AVTransition completeTransition:] () #16 0x00000001b2b08a04 in -[UIViewPropertyAnimator _executeCompletionHandlerWithFinalPosition:] () #17 0x00000001b2b08ac4 in -[UIViewPropertyAnimator _runCompletions:finished:] () #18 0x00000001b2b07b10 in __61-[UIViewPropertyAnimator _setupAssociatedViewAnimationState:]_block_invoke () #19 0x00000001b375214c in UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK () #20 0x00000001b28e2258 in -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] () #21 0x00000001b28e1d8c in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] () #22 0x00000001b297c330 in -[UIViewAnimationState animationDidStop:finished:] () #23 0x0000000213b66110 in -[UIViewAnimationStateAccessibility animationDidStop:finished:] () #24 0x000000018fe7e288 in CA::Layer::run_animation_callbacks(void*) () And the exception is:  "[<WebAVPlayerController valueForUndefinedKey:]: this class is not key value coding-compliant for the key coordinatedPlaybackActive."**
Topic: Safari & Web SubTopic: General Tags:
1
0
887
Feb ’23
WKWebView Mac Catalyst Text Selection Issues?
I notice on some pages to be having text selection issues on Mac Catalyst. AppKit WKWebview appears to work better. Is there a workaround? Related: https://stackoverflow.com/questions/74959180/how-to-use-appkit-wkwebview-in-a-mac-catalyst-app https://stackoverflow.com/questions/61215569/macos-maccatalyst-wkwebview-text-selection-behavior Would be great if Mac Catalyst just got the normal Mac WKWebView but there appears to be differences.
0
0
716
Feb ’23
WKWebView elementFullscreenEnabled on iPad. Full screen video doesn't properly resize on orientation change.
I set the elementFullscreenEnabled property on WKPreferences to YES. On iPad this enables web videos to be played in full screen. However when I play the video and rotate the device, the layout becomes completely broken on orientation change. Anyone know of a workaround? I can key value observe the web view's full screen state property but there is no obvious way to get ahold of the UI being used to play the video?
1
0
866
Feb ’23
Mac Catalyst Copying NSURLs to the pasteboard translation is bad?
So I copy a link to the pasteboard in Mac Catalyst. I can do this directly or by using system provided "Copy" in WKWebView from the WebUIDelegate method -webView:contextMenuForElement:willCommitWithAnimator: (which creates a "Copy Link action in the system provided "suggested actions"). So when I copy a link on Mac Catalyst like this: [UIPasteboard generalPasteboard].URLs = @[urlToCopy]; And I try to paste it in Xcode (assuming I'd be pasting the URL string in this context) Xcode plays NSBeep and nothing is pasted. I have to paste the link in TextEdit in a Plain Text Document, select the text, copy it again and then paste it back in Xcode. I'm having a pretty bad day here. Almost nothing is working.
3
0
765
Feb ’23
Mac Catalyst: UISearchController with UITableView Randomly Moves the Scroll Position after Swipe Action
I have a UISearchController. It uses a search results controller (the search results controller uses a UITableView). If I select a row.. scroll a bit, deactivate the window then reactivate the window the scroll position starts flying. Usually this random scroll exposes the selected row but sometimes it scroll elsewhere. I subclassed UITableView to try to figure out what's causing this random scrolling. I have a breakpoint in -scrollRectToVisible:scrollRectToVisible: -(void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated {     [super scrollRectToVisible:rect animated:animated]; //<--Break point here } And was able to determine that its coming from UIFocusSystem/UISearchController: #1 0x00000001d65d748c in -[UISearchController _willUpdateFocusInContext:withAnimationCoordinator:] () #2 0x00000001d611fdd0 in __85-[UIFocusSystem _sendWillUpdateFocusNotificationsInContext:withAnimationCoordinator:]_block_invoke () #3 0x00000001d60d4944 in _UIFocusEnvironmentEnumerateAncestorEnvironments () #4 0x00000001d6120480 in -[UIFocusSystem _sendNotificationsForFocusUpdateInContext:withAnimationCoordinator:usingBlock:] () #5 0x00000001d611faf8 in -[UIFocusSystem _sendWillUpdateFocusNotificationsInContext:withAnimationCoordinator:] () #6 0x00000001d611f42c in -[UIFocusSystem _updateFocusWithContext:report:] () #7 0x00000001d611b90c in -[UIFocusSystem _setEnabled:withAnimationCoordinator:] () #8 0x00000001d61a1128 in __49-[_UIFocusSystemSceneComponent _setupFocusSystem]_block_invoke () #9 0x00000001d618ccac in -[_UIFocusStateObserver notifyObserversIfNecessary] () -- Workarounds/input always appreciated.
0
0
486
Mar ’23
Verify Receipt Endpoint Can't Get Passed Mac App Store Review Team
When I use the verify receipt endpoint in my Mac apps, the Mac App Store review team always rejects them. I have apps that have been on the store for years that used this code and they verify in the production environment fine but every time I try to send an update it gets rejected. My app does simple receipt validation like this: My app uses the verify receipt endpoint and talks to the server directly (not super secure but that’s okay I don’t need to maintain a server for this app). The verify receipt endpoint always says the receipt is invalid in in the App Review team’s testing environment. My app calls exit(173) after the verify receipt endpoint tells me the receipt is invalid. The systems shows a dialog saying the app is Damaged. I cannot reproduce this in my testing environment nor do I see the issue occurring in the current versions of these apps live on the App Store (no code changes has been made to the receipt validation code). The issue seems to only occur in the App Review team’s testing environment. I've been running into this issue for about a year now. I had a TSI opened last year related to this but the issue never got resolved. I just have to comment out the receipt validation code in every app...then submit my update. Anyone else run into this with verify receipt?
0
0
445
Apr ’23
How to get MPNowPlayingInfoCenter to display the MPNowPlayingInfoPropertyPlaybackProgress value instead of seconds?
I'm trying to configure the "Now Playing" information for my app on iOS. Using MPNowPlayingInfoCenter/MPRemoteCommandCenter is pretty straightforward for this. The issue I'm having is that the audio I'm playing is generated "on the fly" and I do not know the exact duration in seconds. I am able to synthesize an NSProgress to display the progress of the playback but the units are not in seconds. So if I use the NSProgress units with MPNowPlayingInfoCenter the "Now Playing" shows the units in seconds but it appears to be jumpy (because again my progress units are not in seconds but an approximation of the percent completed). [playInfo setObject:@(self.progress.totalUnitCount) forKey:MPMediaItemPropertyPlaybackDuration]; [playInfo setObject:@(self.progress.completedUnitCount) forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime]; I see there is a MPNowPlayingInfoPropertyPlaybackProgress which looks like it would be perfect. I tried setting that instead of MPMediaItemPropertyPlaybackDuration/MPNowPlayingInfoPropertyElapsedPlaybackTime but it appears to have no effect in the "Now Playing" UI. I also tried setting MPNowPlayingInfoPropertyIsLiveStream to YES but that just makes the "Now Playing" UI display "Live" instead of the progress value. Is there a way I can show a progress bar without the units being displayed in seconds? Thanks in advance.
0
0
883
May ’23
Is there a way to know if UISheetPresentationController is currently being resized by the user?
I’m using UISheetPresentationController with a UIViewController. While the sheet is being resized I’d like to position certain subviews a certain way during the resizing event. For example I may hide some subviews on a smaller detent and unhide them on a larger detent. But while the sheet is being resized in between the small and large detent I’d like to have some subviews placed at certain locations of the view hierarchy. As far as I can tell the only way to do this is with unreliable hard coded values: -(void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; CGFloat currentHeight = self.view.bounds.size.height; if (currentHeight <= mediumDetent) { [self doLayoutForMediumDetent]; } else if (currentHeight >= fullSizeDetent) { [self doLayoutForFullSizedDetent]; } else { [self doLayoutInBetweenFullAndMediumSheetWithCurrentSize:currentHeight]; } } I don't really know for sure the height of the detents. I'm using estimates so this layout code is fragile. For the medium detent the documentation states that it is "A system detent for a sheet that is approximately half the height of the screen, and is inactive in compact height." but on certain devices the medium detent height is not exactly 1/2 the screen height. Ideally it would be nice to have API like this: -(void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; CGFloat mediumHeight = [self.sheetPresentationController resolvedHeightForDetentWithIdentiier:someID withTraitCollection:self.traitCollection]; CGFloat fullHeight = [self.sheetPresentationController resolvedHeightForDetentWithIdentiier:FullSizeID withTraitCollection:self.traitCollection]; if (self.sheetPresentationController.isInLiveResize) { //do whatever during live resize } else { //do whatever at the current size } } Is there currently a better way to achieve what I'm after?
Topic: UI Frameworks SubTopic: UIKit Tags:
2
0
526
May ’23
UIKit doesn't always retain custom UIViewControllerTransitioningDelegate?
So I'm using a custom presentation controller which requires me to specify a transitioningDelegate on the view controller before presenting it like this: vcToPresent.modalPresentationStyle = UIModalPresentationCustom; vcToPresent.transitioningDelegate = transitionDelegate; Now I want to enforce a particular view controller to always use my custom presentation controller. Unfortunately I cannot just override the presentationController getter and return my own custom class; I have to make a transitioning delegate and an additional animator (and my custom presentation controller can animate alongside it). To have a view controller use my own presentation controller I have to do this: -(void)presentCustomVC { MyViewController *vcToPresent = [MyViewController makeViewController]; MyTransitioningDelegate *transitionDelegate = [[MyTransitioningDelegate alloc]init]; vcToPresent.modalPresentationStyle = UIModalPresentationCustom; vcToPresent.transitioningDelegate = transitionDelegate; [self presentViewController:vcToPresent animated:YES completion:nil]; } So I have to copy this transitioningDelegate set up code in every view controller that presents MyViewController. I can make the API look a little better by creating a factory method in MyViewController like this: +(MyViewController*)makeViewController { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil]; MyViewController *theVC = [storyboard instantiateInitialViewController]; MyTransitioningDelegate *transDelegate = [[MyTransitioningDelegate alloc]init]; theVC.modalPresentationStyle = UIModalPresentationCustom; theVC.transitioningDelegate = transDelegate; return theVC; } The problem with that is the transitioningDelegate gets deallocated right away (before the view controller can be presented). The transitioningDelegate property on UIViewController is weak for some reason. Shouldn't the transitioningDelegate property be declared strong? My custom transitioningDelegate has no strong reference to the presented view controller? If I add a redundant property to MyViewController like this: @property (nonatomic,strong) MyTransitioningDelegate *strongTransDelegate; And then do this: theVC.modalPresentationStyle = UIModalPresentationCustom; theVC.transitioningDelegate = transDelegate; theVC.strongTransDelegate = transitionDelegate; All seems to work well. When the view controller is dismissed the transitioning delegate is deallocated. However I'm assuming the transitioningDelegate property on UIViewController was declared as weak for a reason? I don't want to accidentally create a retain cycle in some unforeseen circumstance. Documentation makes no mention on who should be the "owner" of the transitioning delegate?
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
531
Jun ’23
Custom UIViewControllerAnimatedTransitioning from UINavigationController when segue is performed from UISearchController's searchResultsController?
I have a custom pop animation is use with UINavigationController. I provide this via the delegate method - -(nullable id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController*)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController*)fromVC toViewController:(UIViewController*)toVC And it works except when I push the view controller initially from UISearchController's .searchResultsController. This issue is that when I push on the navigation stack when the UISearchResultsController is displaying the searchResultsController, when I pop back the UIViewControllerContextTransitioning passed to my animator doesn't provide values to account for the search controller displayed over the main view controller and the custom animation doesn't work. Is there a good way to handle this? Thanks in advance.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
375
May ’23
Useful WWDC Videos Missing from Previous Years (For example: "Customized Loading in WKWebView from WWDC 2017")
It appears a lot of useful WWDC session videos from previous years have been scrubbed from the developer.apple.com? I cannot find the WWDC session "Customized Loading in WKWebView" from 2017 in the Developer app nor on the developer website. There are lots of other videos that would be useful to watch, even from years ago. Am I just not looking in the right place?
0
0
569
Jul ’23
WKWebView document.onvisibilitychange event not always being fired. Need to detect page changes reliability from WKUserScript
I need to prepare an object when the user navigates to a new page in WKWebView and refresh UI. I run a WKUserScript on behalf of the user to do this. I'm using the readystatechange event listener to detect initial page load. I'm also listening to the visibilitychange event to refresh UI if the DOM is already loaded on a "Go back" or "Go Forward" action. document.addEventListener('visibilitychange', () => { //do whatever if the DOM is already loaded and if we are visible. }); document.addEventListener('readystatechange', (event) => { //do whatever when page is loaded }); On certain websites however I noticed that neither of these events are being fired when I navigate -goForward: and -goBack: I'm not sure why. My WKUserScript is in WKContentWorld.defaultClientWorld so it shouldn't be interfering with the javascript of the page. Is there another JS event I'm missing? I could pick up the changed URL on the native code side but it would be nice to keep this all contained within the WKUserScript as this UI is for the "webview" and the native code shouldn't have to be bothered with having to patch in the additional glue. Is there another DOM event I need to listen to? I tried listening to window's pageshow but that didn't work. Also experimented a bit with the window's popstate event but no luck.
4
0
1.9k
Jul ’23