Post

Replies

Boosts

Views

Activity

UIWindow safeAreaInset.bottom value is 20.0 on iPad even when window is presented like a "modal view controller" via UIWindowSceneActivationAction
When I open a new window via UIWindowSceneActivationAction, the window is shown like a modally presented view controller. I noticed a little layout hiccup when the window is in this state, because the window is reporting a safeAreaInset.bottom value of 20.0 even though the window is nowhere near the Home Indicator. Is there a good way to detect when a window is in this "modal like presentation" state on iPad? Size classes don't provide. I'd hate to have to sniff the frame of the window and compare it to the mainScreen frame (I know UIScreen.mainScreen is deprecated)?
Topic: UI Frameworks SubTopic: UIKit Tags:
1
0
458
Oct ’22
Xcode Extensions in Xcode 14?
I noticed an Xcode Extension I wrote a couple of years ago isn't showing up in the Editor menu of Xcode. So I opened up the project, ran the Extension and the grayed out version of Xcode shows up but my extension no longer appears in the "Editor" menu. So I just tried to create a brand new Xcode project, with an Xcode extension. Right out of the box, no code changes from the template, and I can't get the new project's Xcode extension to appear in the "Editor menu". In System Preferences the app is checked off under "Xcode Extensions" but still nowhere to be found?
1
0
3.2k
Oct ’22
if (@available(macCatalyst 15.0,*)) vs if (@available(iOS 15.0, *))
Experimenting with Mac Catalyst a bit. I see sometimes the compiler warns me about an API and suggests this fix:   if (@available(macCatalyst 15.0,*)) { /// Use API for this version of catalyst.... } And when I switch back to run on an iOS device the warning comes back and this time I get the suggestion: if (@available(iOS 15.0, *)) { //iOS 15 } If I just use the @available iOS 15 check and remove the macCatalyst check the compiler stops warning me when I try building on my Mac and on iOS, but the same isn't true the other way around (if I have code inside the macCatalyst version check, switching to build for an iOS device still warns me). I was expecting that code inside the if @available(macCatalyst 15,*) statement would only run on Mac catalyst if the version of macOS supports the API, but would not run on iOS at all (even if the API is available there too) but I still get compiler warnings on iOS and a suggestion for an extra if (@available(iOS 15.0, *)) which produces the following:  if (@available(macCatalyst 15.0,*))     {         if (@available(iOS 15.0, *))         { //do something iOS 15 and later...and macCatalyst 15 and later. } } What do I make of the macCatalyst availability check? It comes up in code completion but just using the iOS check seems like the correct way (it silences compiler warnings but I haven't tested on an older version of macOS to see if using any of this API would produce a crash). I conclude that if (@available(iOS 15.0, )) should be used pretty much always instead of if (@available(macCatalyst 15.0,)) and if I need code only for Mac Catalyst I should check the TARGET_OS_MACCATALYST macro instead:  #if TARGET_OS_MACCATALYST #else //iOS only #endif Is that correct?
1
0
1.4k
Oct ’22
Window's title bar separator draws way out of place on Mac Catalyst, not even close to title bar location
So I built my app with Mac Catalyst. I see this little line appear and disappear periodically in the window. Then all of a sudden it disappears when the window's activation state changes sometimes. It looks like a weird little glitch. Turns out this is the title bar's separator which is UITitlebarSeparatorStyleAutomatic (I believe the system hides/shows the separator in this mode based on current window states. I change the separator style to shadow and sure enough it draws like a shadow and never disappears. It's not even close to where the separator is supposed to be (nowhere near the title bar). The only workaround I have is to use UITitlebarSeparatorStyleNone which I'll do if I have to but was wondering if someone else has run into this and has a better workaround.
5
2
1.1k
Oct ’22
Mac Catalyst When to Handle Setting Min/Max Size for UISplitViewController columns? Window Resize Event?
Trying to use UISplitViewController. Since this app can be run on many different monitor sizes I want to allow the splits to be resized reasonably. There is this API: //Allow setting the primary column width with point values. This is especially useful in Catalyst where the window may be resized more often. // If set to non-Automatic, takes precedence over preferredPrimaryColumnWidthFraction. @property(nonatomic, assign) CGFloat preferredPrimaryColumnWidth API_AVAILABLE(ios(14.0)); // default: UISplitViewControllerAutomaticDimension > > @property(nonatomic, assign) CGFloat minimumSupplementaryColumnWidth API_AVAILABLE(ios(14.0)); @property(nonatomic, assign) CGFloat maximumSupplementaryColumnWidth API_AVAILABLE(ios(14.0)); // An animatable property that can be used to adjust the minimum absolute width of the primary view controller in the split view controller. @property(nonatomic, assign) CGFloat minimumPrimaryColumnWidth API_AVAILABLE(ios(8.0)); // default: UISplitViewControllerAutomaticDimension // An animatable property that can be used to adjust the maximum absolute width of the primary view controller in the split view controller. @property(nonatomic, assign) CGFloat maximumPrimaryColumnWidth API_AVAILABLE(ios(8.0)); // default: At what point in time should I be changing the preferredPrimaryColumnWidth, the min/and max width values? What event? If I was in Appkit I could maybe use something like NSWindowDidResizeNotification, then compute min/max sizes for each column based off the current window size (but I think NSSplitView gives the delegate an opportunity to control constraining column sizes if I remember correctly so I don't think that it would necessary to listen for a window resize event). I find the default sizes set by UISplitViewController to be insufficient (I want to allow users to size columns wider). Ideally this would be easier if there was minimumPrimaryColumnFraction and maxPrimaryColumnFraction. Then I just set the min/max fractions once to reasonable values and not worry about changing them on window resize. But since we can only set min/max with a hardcoded point size it seems more complicated?
0
1
540
Oct ’22
Unable to get CloudKit sync Notifications on Mac Catalyst Build -application:didFailToRegisterForRemoteNotificationsWithError: is being called
Working on a Mac Catalyst version of one of my apps. I noticed making changes on my iPhone (debug environment) aren't being pushed to my Mac (also in debug environment). Then when I quit and relaunch the app and manually force an iCloud sync at launch I get all the changes. At app launch I see the following method is being called on my AppDelegate after I attempt to register remote notifications: -application:didFailToRegisterForRemoteNotificationsWithError: with the error: Notifications are not allowed for this application" UserInfo={NSLocalizedDescription=Notifications are not allowed for this application}. Anyone experience this and have a solution? Under "Signing and Capabilities" I see an entry for Push Notifications for iOS and macOS.
1
0
960
Oct ’22
UIKitCore -[UIResponder doesNotRecognizeSelector:] crashes since IOS 15.7
Since iOS 15.7 these crash reports have started appearing: 0   CoreFoundation                0x18043bd1c __exceptionPreprocess + 216 (NSException.m:200) 1   libobjc.A.dylib               0x197c60ee4 objc_exception_throw + 56 (objc-exception.mm:565) 2   CoreFoundation                0x18050c75c -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:147) 3   UIKitCore                     0x18359320c -[UIResponder doesNotRecognizeSelector:] + 268 (UIResponder.m:685) 4   CoreFoundation                0x1803d561c forwarding + 1472 (NSForwarding.m:3577) 5   CoreFoundation                0x1803d482c _CF_forwarding_prep_0 + 92 6   CoreFoundation                0x1803d22e8 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 20 (CFNotificationCenter.c:652) 7   CoreFoundation                0x1804678e4 ___CFXRegistrationPost_block_invoke + 48 (CFNotificationCenter.c:173) 8   CoreFoundation                0x18043cc04 _CFXRegistrationPost + 416 (CFNotificationCenter.c:199) 9   CoreFoundation                0x1803e7070 _CFXNotificationPost + 708 (CFNotificationCenter.c:1147) 10  Foundation                    0x181ad704c -[NSNotificationCenter postNotificationName:object:userInfo:] + 92 (NSNotification.m:560) 11  UIKitCore                     0x182a9ac08 -[UIScene _invalidate] + 664 (UIScene.m:942) 12  UIKitCore                     0x182c2765c -[UIWindowScene _invalidate] + 160 (UIWindowScene.m:334) 13  UIKitCore                     0x182991f34 -[UIApplication workspace:willDestroyScene:withTransitionContext:completion:] + 216 (UIApplication.m:3999) 14  UIKitCore                     0x1829291a0 -[UIApplicationSceneClientAgent scene:willInvalidateWithEvent:completion:] + 360 (UIApplicationSceneClientAgent.m:61) 15  FrontBoardServices            0x1915b79d8 -[FBSScene _callOutQueue_agent_willDestroyWithTransitionContext:completion:] + 256 (FBSScene.m:456) 16  FrontBoardServices            0x1915bf810 __84-[FBSWorkspaceScenesClient _queue_invalidateScene:withTransitionContext:completion:]_block_invoke_2 + 100 (FBSWorkspaceScenesClient.m:622) 17  FrontBoardServices            0x1915a3bdc -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232 (FBSWorkspace.m:352) 18  FrontBoardServices            0x1915b5470 __84-[FBSWorkspaceScenesClient _queue_invalidateScene:withTransitionContext:completion:]_block_invoke + 280 (FBSWorkspaceScenesClient.m:621) 19  libdispatch.dylib             0x1800fc094 _dispatch_client_callout + 16 (object.m:560) 20  libdispatch.dylib             0x18009f150 _dispatch_block_invoke_direct$VARIANT$mp + 220 (queue.c:501) 21  FrontBoardServices            0x1915a52ac FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 40 (FBSSerialQueue.m:157) 22  FrontBoardServices            0x1915a47c0 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 176 (FBSSerialQueue.m:181) 23  FrontBoardServices            0x1915a8960 -[FBSSerialQueue _performNextFromRunLoopSource] + 24 (FBSSerialQueue.m:194) 24  CoreFoundation                0x18045c4fc CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24 (CFRunLoop.c:1972) Looks like all system code. Anyone else running into these since iOS 15.7?
Topic: UI Frameworks SubTopic: UIKit Tags:
12
4
4.2k
Oct ’22
UICollectionView List Style on Mac Catalyst: Prevent the Collection View From Changing the Selection when the Selected Row's Parent is Collapsed?
I'm using UICollectionView with a list style on Mac (looks like NSOutlineView in a sidebar). I have expandable rows. So this is the behavior I'm after: -If the user has a row selected, but decides to collapse the selected row's parent, I want to maintain the current selection. Instead this is what happens by default: -If a row selected and I collapse the parent the collection, the collection view automatically selects another row (in my case the first row at index path 0-0). Just because the user collapses the parent doesn't mean the selection should change. For instance in Xcode's Navigator I can have a file selected in a Group and collapse the group without modifying the current selection.
2
0
640
Oct ’22
UINavigationController inside UISplitViewController's UISplitViewControllerColumnSupplementary Doesn't Appear on Mac Catalyst
Working on a Mac Catalyst app. I have a UInavigationController. On iOS this is full screen but on Mac Catalyst I'm using it inside a UISplitViewController in the supplementary column. This view controller's root view controller has a navigationItem which configures a UISearchController. The search bar is nowhere to be found unless I set it to UINavigationItemSearchBarPlacementStacked. So is UINavigationItemSearchBarPlacementInline not supported for the supplementary column of a UISplitViewController? If that's the case I'm fine with that actually but there's got to be a way to make UINavigationItemSearchBarPlacementStacked look a little better on Mac? The search bar border is barely visible on a white background.
1
0
1.1k
Oct ’22
Disable vibrancy on titlebar/toolbar area of window on Mac Catalyst?
I can't seem to get rid of the "vibrancy" effect on the titlebar/toolbar area of the window on Mac Catalyst. I have a triple Split View controller. The primary vc style is sidebar in the split vc.. And that has the blur/visual effect and that's all well and good. But the title bar area on the supplementary column has the blur effect too and it looks kind of terrible (the navigation bar in the supplementary view controller has all of its navigationBar appearances configured with opaque content:   UINavigationBarAppearance *opaqueAppearance = [[UINavigationBarAppearance alloc]init];     [opaqueAppearance configureWithOpaqueBackground];     opaqueAppearance.backgroundEffect = nil;     opaqueAppearance.backgroundColor = [UIColor myColor]; //set to all appearances But I still get the blur effect on the navigation bar, which presumably is being mapped to NSToolbar. Is it possible to disable this blur effect for the column? It really doesn't look good in my app.
0
0
636
Oct ’22
Crash: Focus item <UITableViewCell> does not provide a parentFocusEnvironment.
I'm on Mac Catalyst. I have a UISearchController and I keep getting this crash after I clear the search bar, adjust the search scope segmented control if one of the UITableViewCells is focused (via arrow key press) before Focus item does not provide a parentFocusEnvironment. I can workaround the problem by overriding -parentFocusEnvironment, holding the parent UITableView in a property and returning it: -(id<UIFocusEnvironment>)parentFocusEnvironment { id<UIFocusEnvironment>theFocus = [super parentFocusEnvironment]; if (theFocus == nil) { return self.cachedParentFocus; } else { self.cachedParentFocus = theFocus } return theFocus; } The problem with this is it is likely to create a retain cycle (I did try a weak reference but that can cause the following crasher on deallocation (the focus environment continues to call this method on the table view cell even when its outside of a UIWindow): “Cannot form weak reference to instance (0x13799a000) of class UITableView. It is possible that this object was over-released, or is in the process of deallocation.” Anyone run into this and know of a potential workaround?
1
0
998
Oct ’22
Determine selected text color to use in Mac Catalyst for UITableView Cells When Row is Selected But Table View Doesn't Have Active Focus?
So when a row is selected in UITableView and the table view / cells within it have focus, and the window is active.... the rows are selected with the system Accent color (in my case blue). I have a view inside the table view cell that does custom drawing. When the cell is selected I draw text white (when unselected I draw the text using UIColor.labelColor). So when the window is not active but the table view row is selected, the selected background color changes to light gray. In this case I draw the text black (because it looks better against the light gray selection color on an inactive window). However when the row is selected but another view in the window has focus (say the sidebar) the selected row turns back to the light gray color. In this case my text is incorrectly drawing white instead of black on the light gray background. How do I check for this state from UIKit? In AppKit I think I'd be using: NSColor.unemphasizedSelectedTextColor https://developer.apple.com/documentation/appkit/nscolor/2998834-unemphasizedselectedtextcolor?language=objc I have to update text color manually because I'm doing custom drawing in these table view cells (I have a view that overrides drawRect:) I can't just use the dynamic colors like UIColor.labelColor. I have to set the colors on state change manually and call setNeedsDisplay on my view. How do I check for the unemphasized state? I did inspect whether or not my table view cell is in the active focusItem's environment, and if it is not I assume the light gray selected color is being used. This worked most of the time but there still seems to be some states where the unemphasized selection color (light gray)is being used on selected cells when the the table view cell is in the active focus environment and my text incorrectly draws white.
1
1
1.5k
Oct ’22
UITableView Doesn't Properly Update Focus When Extending Selection by Holding the Shift Key+Clicking on Mac Catalyst
My table view supports multiple selection. When holding down the shift key and clicking to extend the selection on Mac focus doesn't move to the clicked row. This isn't how macOS apps normally behave. I tried working around the problem by catching the last selected index path and forcing a focus update: -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { self.lastSelectedIndexPath = indexPath; } -(void)tableView:(UITableView*)tableView didDeselectRowAtIndexPath:(NSIndexPath*)indexPath {     if ([indexPath isEqual:self.lastSelectedIndexPath])     {         self.lastSelectedIndexPath = nil;     } } -(void)tableViewDidEndMultipleSelectionInteraction:(UITableView *)tableView {   [tableView setNeedsFocusUpdate];     [tableView updateFocusIfNeeded]; } -(NSIndexPath*)indexPathForPreferredFocusedViewInTableView:(UITableView *)tableView { return self.lastSelectedIndexPath; } But that didn't work. UITableview never calls -indexPathForPreferredFocusedViewInTableView: after my -setNeedsFocusUpdate / -updateFocusIfNeeded calls. I tried subclassing UITableView and overriding -preferredFocusEnvironments but that isn't called. Focus system just ignores updating for shift click. Anyone know of a workaround?
1
0
657
Oct ’22
Update title of NSMenuItem in Menu Bar on Mac Catalyst Based on Current Context?
I'm using UIMenuBuilder API to add a menu item to the menu bar on Mac Catalyst (adding a UIKeyCommand object). So depending on the current selection the title of the menu item should change. As an example in Finder if a single file is selected and you go to the "Edit" menu in the menu bar there is an item that says "Copy Filename" Now select two files in Finder and go to Edit menu in the menu bar and now it says "Copy 2 Items" Updating a NSMenuItem in Appkit is pretty easy. I figured I'd be able to do this in -canPerformAction:withSender: but the system doesn't pass my UIKeyCommand as the sender but instead an instance of a private class _UIMenuBarItem. I assume there must be a way to dynamically update the title of a menu bar item in a Catalyst app?
1
0
996
Nov ’22
Mac Catalyst: UISplitViewControllerColumnSecondary doesn't get key focus when the Tab Key is Pressed in a Triple UISplitViewController.
My UISplitViewController is configured like this: A list (collection view) is used in the primary view controller (sidebar style). When a selection is made in the primary view controller a table view displays data in the supplementary column. When a selection is made in the supplementary view controller, a view controller with scrollable content is shown in the secondary view controller. This is like the Mail app on Mac. So when I run the app I hit the tab key once and the list (collection view) in the primary column gets focus. I can navigate the list with the keyboard. This works as expected. So now with a selection in the list, a table view is showing in the supplementary column. I hit the tab key again and the table view gets focus. This works as expected as I can navigate the table view from the keyboard with the arrow keys. Now with a selection made in the table view, the scrollable view controller is showing in the secondary view controller column. I hit the tab key again and focus goes back to the list in the primary column. This is not the expected behavior. I'd expect hitting tab would move focus to the scroll view in the secondary column instead of jumping back to the primary column (as I should be able to scroll the scroll view in the secondary column with the up and down arrow keys). The user is then required to click on the secondary view controller in order to scroll it with the arrow keys. This breaks full keyboard navigation. The behavior I'm after is actually the default behavior in the Mail app but I can't figure out how to get it to work in Mac Catalyst?
3
0
921
Nov ’22
UIWindow safeAreaInset.bottom value is 20.0 on iPad even when window is presented like a "modal view controller" via UIWindowSceneActivationAction
When I open a new window via UIWindowSceneActivationAction, the window is shown like a modally presented view controller. I noticed a little layout hiccup when the window is in this state, because the window is reporting a safeAreaInset.bottom value of 20.0 even though the window is nowhere near the Home Indicator. Is there a good way to detect when a window is in this "modal like presentation" state on iPad? Size classes don't provide. I'd hate to have to sniff the frame of the window and compare it to the mainScreen frame (I know UIScreen.mainScreen is deprecated)?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
1
Boosts
0
Views
458
Activity
Oct ’22
Xcode Extensions in Xcode 14?
I noticed an Xcode Extension I wrote a couple of years ago isn't showing up in the Editor menu of Xcode. So I opened up the project, ran the Extension and the grayed out version of Xcode shows up but my extension no longer appears in the "Editor" menu. So I just tried to create a brand new Xcode project, with an Xcode extension. Right out of the box, no code changes from the template, and I can't get the new project's Xcode extension to appear in the "Editor menu". In System Preferences the app is checked off under "Xcode Extensions" but still nowhere to be found?
Replies
1
Boosts
0
Views
3.2k
Activity
Oct ’22
if (@available(macCatalyst 15.0,*)) vs if (@available(iOS 15.0, *))
Experimenting with Mac Catalyst a bit. I see sometimes the compiler warns me about an API and suggests this fix:   if (@available(macCatalyst 15.0,*)) { /// Use API for this version of catalyst.... } And when I switch back to run on an iOS device the warning comes back and this time I get the suggestion: if (@available(iOS 15.0, *)) { //iOS 15 } If I just use the @available iOS 15 check and remove the macCatalyst check the compiler stops warning me when I try building on my Mac and on iOS, but the same isn't true the other way around (if I have code inside the macCatalyst version check, switching to build for an iOS device still warns me). I was expecting that code inside the if @available(macCatalyst 15,*) statement would only run on Mac catalyst if the version of macOS supports the API, but would not run on iOS at all (even if the API is available there too) but I still get compiler warnings on iOS and a suggestion for an extra if (@available(iOS 15.0, *)) which produces the following:  if (@available(macCatalyst 15.0,*))     {         if (@available(iOS 15.0, *))         { //do something iOS 15 and later...and macCatalyst 15 and later. } } What do I make of the macCatalyst availability check? It comes up in code completion but just using the iOS check seems like the correct way (it silences compiler warnings but I haven't tested on an older version of macOS to see if using any of this API would produce a crash). I conclude that if (@available(iOS 15.0, )) should be used pretty much always instead of if (@available(macCatalyst 15.0,)) and if I need code only for Mac Catalyst I should check the TARGET_OS_MACCATALYST macro instead:  #if TARGET_OS_MACCATALYST #else //iOS only #endif Is that correct?
Replies
1
Boosts
0
Views
1.4k
Activity
Oct ’22
Window's title bar separator draws way out of place on Mac Catalyst, not even close to title bar location
So I built my app with Mac Catalyst. I see this little line appear and disappear periodically in the window. Then all of a sudden it disappears when the window's activation state changes sometimes. It looks like a weird little glitch. Turns out this is the title bar's separator which is UITitlebarSeparatorStyleAutomatic (I believe the system hides/shows the separator in this mode based on current window states. I change the separator style to shadow and sure enough it draws like a shadow and never disappears. It's not even close to where the separator is supposed to be (nowhere near the title bar). The only workaround I have is to use UITitlebarSeparatorStyleNone which I'll do if I have to but was wondering if someone else has run into this and has a better workaround.
Replies
5
Boosts
2
Views
1.1k
Activity
Oct ’22
Mac Catalyst When to Handle Setting Min/Max Size for UISplitViewController columns? Window Resize Event?
Trying to use UISplitViewController. Since this app can be run on many different monitor sizes I want to allow the splits to be resized reasonably. There is this API: //Allow setting the primary column width with point values. This is especially useful in Catalyst where the window may be resized more often. // If set to non-Automatic, takes precedence over preferredPrimaryColumnWidthFraction. @property(nonatomic, assign) CGFloat preferredPrimaryColumnWidth API_AVAILABLE(ios(14.0)); // default: UISplitViewControllerAutomaticDimension > > @property(nonatomic, assign) CGFloat minimumSupplementaryColumnWidth API_AVAILABLE(ios(14.0)); @property(nonatomic, assign) CGFloat maximumSupplementaryColumnWidth API_AVAILABLE(ios(14.0)); // An animatable property that can be used to adjust the minimum absolute width of the primary view controller in the split view controller. @property(nonatomic, assign) CGFloat minimumPrimaryColumnWidth API_AVAILABLE(ios(8.0)); // default: UISplitViewControllerAutomaticDimension // An animatable property that can be used to adjust the maximum absolute width of the primary view controller in the split view controller. @property(nonatomic, assign) CGFloat maximumPrimaryColumnWidth API_AVAILABLE(ios(8.0)); // default: At what point in time should I be changing the preferredPrimaryColumnWidth, the min/and max width values? What event? If I was in Appkit I could maybe use something like NSWindowDidResizeNotification, then compute min/max sizes for each column based off the current window size (but I think NSSplitView gives the delegate an opportunity to control constraining column sizes if I remember correctly so I don't think that it would necessary to listen for a window resize event). I find the default sizes set by UISplitViewController to be insufficient (I want to allow users to size columns wider). Ideally this would be easier if there was minimumPrimaryColumnFraction and maxPrimaryColumnFraction. Then I just set the min/max fractions once to reasonable values and not worry about changing them on window resize. But since we can only set min/max with a hardcoded point size it seems more complicated?
Replies
0
Boosts
1
Views
540
Activity
Oct ’22
Unable to get CloudKit sync Notifications on Mac Catalyst Build -application:didFailToRegisterForRemoteNotificationsWithError: is being called
Working on a Mac Catalyst version of one of my apps. I noticed making changes on my iPhone (debug environment) aren't being pushed to my Mac (also in debug environment). Then when I quit and relaunch the app and manually force an iCloud sync at launch I get all the changes. At app launch I see the following method is being called on my AppDelegate after I attempt to register remote notifications: -application:didFailToRegisterForRemoteNotificationsWithError: with the error: Notifications are not allowed for this application" UserInfo={NSLocalizedDescription=Notifications are not allowed for this application}. Anyone experience this and have a solution? Under "Signing and Capabilities" I see an entry for Push Notifications for iOS and macOS.
Replies
1
Boosts
0
Views
960
Activity
Oct ’22
UIKitCore -[UIResponder doesNotRecognizeSelector:] crashes since IOS 15.7
Since iOS 15.7 these crash reports have started appearing: 0   CoreFoundation                0x18043bd1c __exceptionPreprocess + 216 (NSException.m:200) 1   libobjc.A.dylib               0x197c60ee4 objc_exception_throw + 56 (objc-exception.mm:565) 2   CoreFoundation                0x18050c75c -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:147) 3   UIKitCore                     0x18359320c -[UIResponder doesNotRecognizeSelector:] + 268 (UIResponder.m:685) 4   CoreFoundation                0x1803d561c forwarding + 1472 (NSForwarding.m:3577) 5   CoreFoundation                0x1803d482c _CF_forwarding_prep_0 + 92 6   CoreFoundation                0x1803d22e8 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 20 (CFNotificationCenter.c:652) 7   CoreFoundation                0x1804678e4 ___CFXRegistrationPost_block_invoke + 48 (CFNotificationCenter.c:173) 8   CoreFoundation                0x18043cc04 _CFXRegistrationPost + 416 (CFNotificationCenter.c:199) 9   CoreFoundation                0x1803e7070 _CFXNotificationPost + 708 (CFNotificationCenter.c:1147) 10  Foundation                    0x181ad704c -[NSNotificationCenter postNotificationName:object:userInfo:] + 92 (NSNotification.m:560) 11  UIKitCore                     0x182a9ac08 -[UIScene _invalidate] + 664 (UIScene.m:942) 12  UIKitCore                     0x182c2765c -[UIWindowScene _invalidate] + 160 (UIWindowScene.m:334) 13  UIKitCore                     0x182991f34 -[UIApplication workspace:willDestroyScene:withTransitionContext:completion:] + 216 (UIApplication.m:3999) 14  UIKitCore                     0x1829291a0 -[UIApplicationSceneClientAgent scene:willInvalidateWithEvent:completion:] + 360 (UIApplicationSceneClientAgent.m:61) 15  FrontBoardServices            0x1915b79d8 -[FBSScene _callOutQueue_agent_willDestroyWithTransitionContext:completion:] + 256 (FBSScene.m:456) 16  FrontBoardServices            0x1915bf810 __84-[FBSWorkspaceScenesClient _queue_invalidateScene:withTransitionContext:completion:]_block_invoke_2 + 100 (FBSWorkspaceScenesClient.m:622) 17  FrontBoardServices            0x1915a3bdc -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 232 (FBSWorkspace.m:352) 18  FrontBoardServices            0x1915b5470 __84-[FBSWorkspaceScenesClient _queue_invalidateScene:withTransitionContext:completion:]_block_invoke + 280 (FBSWorkspaceScenesClient.m:621) 19  libdispatch.dylib             0x1800fc094 _dispatch_client_callout + 16 (object.m:560) 20  libdispatch.dylib             0x18009f150 _dispatch_block_invoke_direct$VARIANT$mp + 220 (queue.c:501) 21  FrontBoardServices            0x1915a52ac FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 40 (FBSSerialQueue.m:157) 22  FrontBoardServices            0x1915a47c0 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 176 (FBSSerialQueue.m:181) 23  FrontBoardServices            0x1915a8960 -[FBSSerialQueue _performNextFromRunLoopSource] + 24 (FBSSerialQueue.m:194) 24  CoreFoundation                0x18045c4fc CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24 (CFRunLoop.c:1972) Looks like all system code. Anyone else running into these since iOS 15.7?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
12
Boosts
4
Views
4.2k
Activity
Oct ’22
UICollectionView List Style on Mac Catalyst: Prevent the Collection View From Changing the Selection when the Selected Row's Parent is Collapsed?
I'm using UICollectionView with a list style on Mac (looks like NSOutlineView in a sidebar). I have expandable rows. So this is the behavior I'm after: -If the user has a row selected, but decides to collapse the selected row's parent, I want to maintain the current selection. Instead this is what happens by default: -If a row selected and I collapse the parent the collection, the collection view automatically selects another row (in my case the first row at index path 0-0). Just because the user collapses the parent doesn't mean the selection should change. For instance in Xcode's Navigator I can have a file selected in a Group and collapse the group without modifying the current selection.
Replies
2
Boosts
0
Views
640
Activity
Oct ’22
UINavigationController inside UISplitViewController's UISplitViewControllerColumnSupplementary Doesn't Appear on Mac Catalyst
Working on a Mac Catalyst app. I have a UInavigationController. On iOS this is full screen but on Mac Catalyst I'm using it inside a UISplitViewController in the supplementary column. This view controller's root view controller has a navigationItem which configures a UISearchController. The search bar is nowhere to be found unless I set it to UINavigationItemSearchBarPlacementStacked. So is UINavigationItemSearchBarPlacementInline not supported for the supplementary column of a UISplitViewController? If that's the case I'm fine with that actually but there's got to be a way to make UINavigationItemSearchBarPlacementStacked look a little better on Mac? The search bar border is barely visible on a white background.
Replies
1
Boosts
0
Views
1.1k
Activity
Oct ’22
Disable vibrancy on titlebar/toolbar area of window on Mac Catalyst?
I can't seem to get rid of the "vibrancy" effect on the titlebar/toolbar area of the window on Mac Catalyst. I have a triple Split View controller. The primary vc style is sidebar in the split vc.. And that has the blur/visual effect and that's all well and good. But the title bar area on the supplementary column has the blur effect too and it looks kind of terrible (the navigation bar in the supplementary view controller has all of its navigationBar appearances configured with opaque content:   UINavigationBarAppearance *opaqueAppearance = [[UINavigationBarAppearance alloc]init];     [opaqueAppearance configureWithOpaqueBackground];     opaqueAppearance.backgroundEffect = nil;     opaqueAppearance.backgroundColor = [UIColor myColor]; //set to all appearances But I still get the blur effect on the navigation bar, which presumably is being mapped to NSToolbar. Is it possible to disable this blur effect for the column? It really doesn't look good in my app.
Replies
0
Boosts
0
Views
636
Activity
Oct ’22
Crash: Focus item <UITableViewCell> does not provide a parentFocusEnvironment.
I'm on Mac Catalyst. I have a UISearchController and I keep getting this crash after I clear the search bar, adjust the search scope segmented control if one of the UITableViewCells is focused (via arrow key press) before Focus item does not provide a parentFocusEnvironment. I can workaround the problem by overriding -parentFocusEnvironment, holding the parent UITableView in a property and returning it: -(id<UIFocusEnvironment>)parentFocusEnvironment { id<UIFocusEnvironment>theFocus = [super parentFocusEnvironment]; if (theFocus == nil) { return self.cachedParentFocus; } else { self.cachedParentFocus = theFocus } return theFocus; } The problem with this is it is likely to create a retain cycle (I did try a weak reference but that can cause the following crasher on deallocation (the focus environment continues to call this method on the table view cell even when its outside of a UIWindow): “Cannot form weak reference to instance (0x13799a000) of class UITableView. It is possible that this object was over-released, or is in the process of deallocation.” Anyone run into this and know of a potential workaround?
Replies
1
Boosts
0
Views
998
Activity
Oct ’22
Determine selected text color to use in Mac Catalyst for UITableView Cells When Row is Selected But Table View Doesn't Have Active Focus?
So when a row is selected in UITableView and the table view / cells within it have focus, and the window is active.... the rows are selected with the system Accent color (in my case blue). I have a view inside the table view cell that does custom drawing. When the cell is selected I draw text white (when unselected I draw the text using UIColor.labelColor). So when the window is not active but the table view row is selected, the selected background color changes to light gray. In this case I draw the text black (because it looks better against the light gray selection color on an inactive window). However when the row is selected but another view in the window has focus (say the sidebar) the selected row turns back to the light gray color. In this case my text is incorrectly drawing white instead of black on the light gray background. How do I check for this state from UIKit? In AppKit I think I'd be using: NSColor.unemphasizedSelectedTextColor https://developer.apple.com/documentation/appkit/nscolor/2998834-unemphasizedselectedtextcolor?language=objc I have to update text color manually because I'm doing custom drawing in these table view cells (I have a view that overrides drawRect:) I can't just use the dynamic colors like UIColor.labelColor. I have to set the colors on state change manually and call setNeedsDisplay on my view. How do I check for the unemphasized state? I did inspect whether or not my table view cell is in the active focusItem's environment, and if it is not I assume the light gray selected color is being used. This worked most of the time but there still seems to be some states where the unemphasized selection color (light gray)is being used on selected cells when the the table view cell is in the active focus environment and my text incorrectly draws white.
Replies
1
Boosts
1
Views
1.5k
Activity
Oct ’22
UITableView Doesn't Properly Update Focus When Extending Selection by Holding the Shift Key+Clicking on Mac Catalyst
My table view supports multiple selection. When holding down the shift key and clicking to extend the selection on Mac focus doesn't move to the clicked row. This isn't how macOS apps normally behave. I tried working around the problem by catching the last selected index path and forcing a focus update: -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { self.lastSelectedIndexPath = indexPath; } -(void)tableView:(UITableView*)tableView didDeselectRowAtIndexPath:(NSIndexPath*)indexPath {     if ([indexPath isEqual:self.lastSelectedIndexPath])     {         self.lastSelectedIndexPath = nil;     } } -(void)tableViewDidEndMultipleSelectionInteraction:(UITableView *)tableView {   [tableView setNeedsFocusUpdate];     [tableView updateFocusIfNeeded]; } -(NSIndexPath*)indexPathForPreferredFocusedViewInTableView:(UITableView *)tableView { return self.lastSelectedIndexPath; } But that didn't work. UITableview never calls -indexPathForPreferredFocusedViewInTableView: after my -setNeedsFocusUpdate / -updateFocusIfNeeded calls. I tried subclassing UITableView and overriding -preferredFocusEnvironments but that isn't called. Focus system just ignores updating for shift click. Anyone know of a workaround?
Replies
1
Boosts
0
Views
657
Activity
Oct ’22
Update title of NSMenuItem in Menu Bar on Mac Catalyst Based on Current Context?
I'm using UIMenuBuilder API to add a menu item to the menu bar on Mac Catalyst (adding a UIKeyCommand object). So depending on the current selection the title of the menu item should change. As an example in Finder if a single file is selected and you go to the "Edit" menu in the menu bar there is an item that says "Copy Filename" Now select two files in Finder and go to Edit menu in the menu bar and now it says "Copy 2 Items" Updating a NSMenuItem in Appkit is pretty easy. I figured I'd be able to do this in -canPerformAction:withSender: but the system doesn't pass my UIKeyCommand as the sender but instead an instance of a private class _UIMenuBarItem. I assume there must be a way to dynamically update the title of a menu bar item in a Catalyst app?
Replies
1
Boosts
0
Views
996
Activity
Nov ’22
Mac Catalyst: UISplitViewControllerColumnSecondary doesn't get key focus when the Tab Key is Pressed in a Triple UISplitViewController.
My UISplitViewController is configured like this: A list (collection view) is used in the primary view controller (sidebar style). When a selection is made in the primary view controller a table view displays data in the supplementary column. When a selection is made in the supplementary view controller, a view controller with scrollable content is shown in the secondary view controller. This is like the Mail app on Mac. So when I run the app I hit the tab key once and the list (collection view) in the primary column gets focus. I can navigate the list with the keyboard. This works as expected. So now with a selection in the list, a table view is showing in the supplementary column. I hit the tab key again and the table view gets focus. This works as expected as I can navigate the table view from the keyboard with the arrow keys. Now with a selection made in the table view, the scrollable view controller is showing in the secondary view controller column. I hit the tab key again and focus goes back to the list in the primary column. This is not the expected behavior. I'd expect hitting tab would move focus to the scroll view in the secondary column instead of jumping back to the primary column (as I should be able to scroll the scroll view in the secondary column with the up and down arrow keys). The user is then required to click on the secondary view controller in order to scroll it with the arrow keys. This breaks full keyboard navigation. The behavior I'm after is actually the default behavior in the Mail app but I can't figure out how to get it to work in Mac Catalyst?
Replies
3
Boosts
0
Views
921
Activity
Nov ’22