Post

Replies

Boosts

Views

Activity

Mac Catalyst Stop UITableView from Discarding Selection When a Row is Swiped?
I have a UITableView that supports multiple selection on Mac. My table view also supports swipe actions. When a row is selected and I swipe on another table view row to expose swipe actions, UITableView discards the current selection for seemingly no reason. To reproduce: Configure a UITableView that allows multiple selection. Configure swipe actions. Run the app. Select a couple rows (via Command click or shift click). Two finger drag on the track pad to expose a swipe action on another row. Swipe to hide the swipe actions (not invoking an action). UITableView discards the entire selection for no apparent reason. Also the UITableView discards the selection without even informing the delegate (I have a label displaying the selection count in the UI and it still shows the selection count before UITableView clears the selection when a row is swiped). I don't want to discard the selection just because a swipe action is exposed. I tried working around the problem by reselecting the rows index paths in -tableView:didEndEditingRowAtIndexPath: -(void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(nullable NSIndexPath*)indexPath { //Swipe action is over..fix the selection: [self reselectIndexPathsAtTheEndOfSwipeActionEditing]; / } But when one of the selected index paths is outside the visible region of the table view scroll position jumps after programmatically reselecting the rows which looks wrong... Anyone have a workaround for this?
0
0
839
Dec ’22
Mac Catalyst UITableView swipe actions sometimes don't work (either getting swallowed by the two finger drag gesture to open the Notification Center or something else)
I have a UITableView in the supplementary column of a UISplitViewController. Every so often trackpad gestures to reveal swipe actions stop working. I believe the gesture may be getting swallowed by the two finger drag to open the Notification Center but I can't be sure, maybe there's another gesture swallowing it. I keep sliding my fingers to reveal the swipe action with no luck. Eventually swipe actions start working again but it really wouldn't be acceptable for me to ship an app this way. Anyone else have issues with the swipe gestures on UITableView not working properly? Advice/workarounds are welcomed.
0
0
536
Dec ’22
Mac Catalyst NSToolbar / Title Bar Doesn't Honor overrideUserInterfaceStyle value of the UIWindow
It is normal to have a preference like: “Always use Dark Mode” in an app to allow the user to opt in to Dark mode in the current app without turning it on System wide. On iOS you can manage this by detecting the change in the app preference and when it is turned on you set the overrideUserInterfaceStyle property on the UIWindow to UIUserInterfaceStyleDark. On Mac Catalyst however this does not work. If you set the overrideUserInterfaceStyle property to UIUserInterfaceStyleDark the NSWindow underneath doesn’t update to reflect dark mode. The titlebar doesn’t update for dark mode either. And neither does the NSToolbar. Only UIViewControllers inside the UIWindow reflect the overrideUserInterfaceStyle Ideally it would be great if there was a overrideUserInterfaceStyle property on UIApplication but there is not. Is there a way to force the NSWindow/NSToolbar created by Mac Catalyst to use a particular appearance (without an Appkit bundle)?
0
1
611
Jan ’23
Mac Catalyst: Mac Specific Data Assets Don't Load from Asset Catalog via NSDataAsset
My configuration: A iOS app that supports Mac Catalyst. This Mac Catalyst app is “optimized for Mac” it is not scaled to match iPad. I open the asset catalog and add a “Data Asset” which is a .txt file. This is set to “Universal.” I add “Mac” variant for this data asset and I add a .txt with different text. I load the string at runtime like this: NSDataAsset *scriptData = [[NSDataAsset alloc]initWithName:@"TextDataAsset"]; NSString *loadedText = [[NSString alloc]initWithData:scriptData.data encoding:NSUTF8StringEncoding]; When I run that on Mac Catalyst the text loadedText is an empty string, which is wrong. Running on iOS I get the expected string. Is this the intended behavior? Am I supposed to use the "iPad" device for Mac assets (because I don't believe that is the case with images, etc.) In any case I filed FB12005255
0
0
608
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
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
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
WKContentRuleList Ability To Apply "css-display-none" to an entire style sheet dynamically?
I see in the documentation that it is possible to hide elements on a page using a CSS selector by setting the action type to css-display-none and then providing a selector. But this is kind of limited. You have to know every selector for every style sheet ahead of time. It's possible to block loading of a style sheet using a block rule. "trigger" : { "load-type" : [ "third-party" ], "url-filter" : "REGEX_FOR_STYLESHEET_OF_KNOWN_NASTY_CONTENT_PROVIDER", "resource-type" : [ "style-sheet" ], "url-filter-is-case-sensitive" : true }, "action" : { "type" : "block" } Is is my understanding that the above rule will block loading of a stylesheet that matches the url-filter but all elements will still be displayed by WKWebView using the default style provided by the browser. Am I misunderstanding? Ideally I'd like to be able to set display:none; for every selector in the evil style sheet. I of course can look at the style sheet and make css-display-none rules for every selector manually but that's pretty much impossible to maintain for rule lists with thousands of entires and will break when the author of the nasty stylesheet makes any changes. Is there a way to accomplish what I'm after using WKContentRuleList?
Topic: Safari & Web SubTopic: General Tags:
0
0
503
Jul ’23
How long does WKContentRuleListStore persist compiled WKContentRuleLists?
I see WKContentRuleListStore saves compile lists by identifier. It's nice that I don't have to recompile the WKContentRuleListStore on every app launch but is there ever an event where the system discards compiled lists (other than me calling -removeContentRuleListForIdentifier:completionHandler:)? The reason I ask is should I be writing a version number with my compiled list? If I change the JSON code on an app update do I need to manually remove compiled lists after an app update before recompiling the new JSON?
Topic: Safari & Web SubTopic: General Tags:
0
0
520
Jul ’23
How to set NSCollectionLayoutVisibleItem's name property for use in UICollectionViewCompositionalLayout?
I'm Using UICollectionViewCompositionalLayout with a section provider and I set the NSCollectionLayoutSectionVisibleItemsInvalidationHandler on a particular section. The NSCollectionLayoutSectionVisibleItemsInvalidationHandler hands back an array of objects conforming to the NSCollectionLayoutVisibleItem protocol which has a name property which always appears to be nil. I figured there must be a way to use this name property to make it easier to do look up for the NSCollectionLayoutVisibleItem objects I'm actually looking. Is there a way to make this property nonnil? Does it get set to the UICollectionViewCell's reuse identifier or something (I'm currently using UICollectionViewCellRegistration)? Is there any documentation on the name property? https://developer.apple.com/documentation/uikit/nscollectionlayoutvisibleitem/3199122-name?language=objc
Topic: UI Frameworks SubTopic: UIKit Tags:
0
1
357
Jul ’23