Post

Replies

Boosts

Views

Activity

WKWebView on Mac causes Autolayout Crash After Exiting Full screen Video
I configured a WKWebView to support full screen elements like this:  WKWebViewConfiguration *webViewConfig = [[WKWebViewConfiguration alloc]init]; WKPreferences *prefs = [[WKPreferences alloc]init];  prefs.elementFullscreenEnabled = YES;  webViewConfig.preferences = prefs; //Create a WKWebView with the configuration and load a url like Youtube that supports playing videos in full screen.... Then I run the app and play a YouTube video. I enter full screen. Then I exit full screen and I hit an Autolayout crash. 0 libobjc.A.dylib 0x188365820 objc_msgSend + 32 1 CoreAutoLayout 0x1904ed82c -[NSLayoutConstraint _layoutEngine] + 36 2 CoreAutoLayout 0x1904ee3c0 __55+[NSLayoutConstraint _addOrRemoveConstraints:activate:]_block_invoke + 160 3 CoreAutoLayout 0x1904d4514 -[NSISEngine withBehaviors:performModifications:] + 88 4 CoreAutoLayout 0x1904ee238 +[NSLayoutConstraint _addOrRemoveConstraints:activate:] + 308 5 WebKit 0x1a82777fc -[WKFullScreenWindowController finishedExitFullScreenAnimationAndExitImmediately:] + 936 6 WebKit 0x1a7d63868 -[WKFullScreenWindowController windowDidExitFullScreen:] + 44 7 CoreFoundation 0x1887a6560 CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER + 148 8 CoreFoundation 0x188844044 ___CFXRegistrationPost_block_invoke + 88 9 CoreFoundation 0x188843f8c _CFXRegistrationPost + 440 10 CoreFoundation 0x188777b64 _CFXNotificationPost + 708 11 Foundation 0x18966738c -[NSNotificationCenter postNotificationName:object:userInfo:] + 88 12 AppKit 0x18c4a3210 -[NSWindow(NSFullScreen) _didExitFullScreen] + 336 13 AppKit 0x18c2aa3ac -[_NSExitFullScreenTransitionController _doAfterExitFullScreen] + 304 14 AppKit 0x18c2acb28 ___NSRunLoopTimerCreateWithHandler_block_invoke + 56 15 CoreFoundation 0x1887cb54c CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 32 16 CoreFoundation 0x1887cb1f4 __CFRunLoopDoTimer + 940 17 CoreFoundation 0x1887cad4c __CFRunLoopDoTimers + 356 18 CoreFoundation 0x1887b0734 __CFRunLoopRun + 1896 19 CoreFoundation 0x1887af878 CFRunLoopRunSpecific + 612 20 HIToolbox 0x191e8ffa0 RunCurrentEventLoopInMode + 292 21 HIToolbox 0x191e8fde4 ReceiveNextEventCommon + 672 22 HIToolbox 0x191e8fb2c _BlockUntilNextEventMatchingListInModeWithFilter + 72 23 AppKit 0x18ba3584c _DPSNextEvent + 632 24 AppKit 0x18ba349dc -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 728 25 AppKit 0x18ba28e0c -[NSApplication run] + 464 26 AppKit 0x18ba00250 NSApplicationMain + 880 27 AppKitWKWebviewProjectForWebInspector 0x102fbbf80 main + 44 (main.m:14) 28 dyld 0x1883a7e50 start + 2544
2
0
788
Feb ’23
Uploading App Preview Video for Mac App Fails with Error "Your app preview contains unsupported or corrupted audio" even though the video contains no audio.
Uploading an App Preview Video for a Mac App Fails with Error "Your app preview contains unsupported or corrupted audio" even though the video contains no audio. Anyone run into this and know of a workaround? I filed FB12151982
2
3
2.7k
Jun ’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
WKContentRuleList JSON file documentation? "trigger" vs "condition"?
I'm having a hard time finding samples that clearly explain how to use WKContentRuleList objects. I read that WKContentRuleList use the same format as Safari content blocker extensions however when I try to compile a content blocker from the sample app AdoptingDeclarativeContentBlockingInSafariWebExtensions it complains about missing a "trigger". I get Error Domain=WKErrorDomain Code=6 "(null)" UserInfo={NSHelpAnchor=Rule list compilation failed: Invalid trigger object.} When I try to use the rules from the AdoptingDeclarativeContentBlockingInSafariWebExtensions sample project: [ { "id": 1, "priority": 1, "action": { "type": "block" }, "condition": {"regexFilter": ".*", "resourceTypes": [ "image" ] } }, { "id": 2, "priority": 1, "action": { "type": "allow" }, "condition": {"regexFilter": "wikipedia", "resourceTypes": [ "image" ] } } ] So if WKContentRuleList requires different keys/value pairs than Safari content blockers are those differences documented anywhere? I can't really find any good info on this. Thanks in advance.
Topic: Safari & Web SubTopic: General Tags:
2
0
804
Jun ’23
Jump to Definition on Symbols in a Swift Framework's Gigantic Generated "Header"?
So I'm looking inside the documentation for TipKit, which ~1400 lines in a single file of documentation. If I right click a symbol there is no "Jump to Definition" in the context menu. Steps to reproduce: Navigate to TipKit generated "header". Right click a symbol like Tip (highlighted in bold): public struct AnyTip : Tip 3rd step) No Jump to Definition menu item appears in the context menu. Is this intentional behavior?
2
0
662
Oct ’23
Use prebuilt dylib built for macOS in macCatalyst?
Is there a way to link a prebuilt dylib that was built for the 'macOS' platform on Mac Catalyst without being warned by Xcode? Generally it would be better to just recompile for Mac Catalyst but this is a third party library and they have a complicated build system with dozens of dependencies that doesn't support Mac Catalyst as of now (although they have iOS and Mac 'regular'). So I would have to spend quite a bit of time trying to sort through their build system to make a Catalyst version myself. The library uses no platform specific UI code and I'm fairly certain that macOS build would work just fine on Mac Catalyst without any changes since it isn't UI related at all. It seems to work fine (apart from Xcode warning me about linking a .dylib built for macOS on Mac Catalyst). I could shim all this away in a NSBundle that is aware of the AppKit world but then I have to make all method calls to the third party framework on Mac Catalyst through the bundle and it would separate my iOS and Catalyst code relying on the same implementation which isn't great. Is there a way I could just replace the 'macOS' platform in the .dylib with macCatalyst to get rid of the warning?
2
1
1.6k
Nov ’23
NSWindow Suddenly Closes After NSTextField Ends Editing (By Clicking into Another NSTextField)
Configuration: I have a NSTextField (multiline) inside an NSWindow. I have another NSTextField (single line) inside an NSBox (which is in the same window). The multiline text field is first responder and is editing. I click on the single line text field inside the NSBox to edit that one. The NSWindow just closes. This is on Sonoma 14.2.1. I subclassed NSWindow and override the close method and put a breakpoint. Here's the call stack that leads to the window suddenly closing: #1 0x0000000189c73d90 in -[NSWindow __close] () #2 0x000000032343 in -[NSApplication(NSResponder) sendAction:to:from:] () #3 0x0000000189b543ac in -[NSControl sendAction:to:] () #4 0x0000000189b542f0 in __26-[NSCell _sendActionFrom:]_block_invoke () #5 0x0000000189b54218 in -[NSCell _sendActionFrom:] () #6 0x0000000189b5413c in -[NSButtonCell _sendActionFrom:] () #7 0x0000000189c4c508 in __29-[NSButtonCell performClick:]_block_invoke () #8 0x0000000189c4c264 in -[NSButtonCell performClick:] () #9 0x0000000189b545a8 in -[NSApplication(NSResponder) sendAction:to:from:] () #10 0x0000000189b543ac in -[NSControl sendAction:to:] () #11 0x0000000189befb48 in -[NSTextField textDidEndEditing:] () #12 0x0000000__CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ () #13 0x000000018625c65c in ___CFXRegistrationPost_block_invoke () #14 0x000000018625c5a4 in _CFXRegistrationPost () #15 0x00000001861971dc in _CFXNotificationPost () #16 0x0000000187289ff0 in -[NSNotificationCenter postNotificationName:object:userInfo:] () #17 0x0000000189bef754 in -[NSTextView(NSSharing) resignFirstResponder] () #18 0x0000000189a9fab8 in -[NSWindow _realMakeFirstResponder:] () #19 0x0000000189b4f18c in -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] () #20 0x0000000189ada79c in -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] () #21 0x0000000189ada45c in -[NSWindow(NSEventRouting) sendEvent:] () #22 0x000000018a1879f4 in -[NSApplication(NSEventRouting) sendEvent:] () #23 0x0000000189dd6908 in -[NSApplication _handleEvent:] () #24 0x00000001899a1d74 in -[NSApplication run] () The mouse click is no where near the close button in the title bar.
2
0
779
Feb ’24
EU Trader Question, How Long Before Apps Removed from EU?
I've been putting off entering my EU "trader status" info. I see this is published on the developer site: "Starting October 16, 2024, developers must provide their trader status to submit new apps or app updates for distribution in the European Union. To comply with the Digital Services Act, go to the Business section by February 17, 2025 to provide your trader status or your app will be removed from the App Store in the EU." So do I have to do this now (today October 16, 2024) to prevent my apps from being removed from the EU App Store (or do I have until February 17, 2025)?
2
0
691
Oct ’24
Error Message when Trying to Submit EU Trader Status: "Something went wrong. Please try again."
I can’t submit an App Update without providing the EU trader information. I keep trying to submit this information. I upload all the documents, go through all the steps, then at the end I get the following error message: “Something went wrong. Please try again.” This is pretty frustrating. Then I had to start over...did it all again and ended up with the exact same error message. So I'm blocked from updating an app today...any advice on how I should proceed?
2
0
553
Nov ’24
Does INIntent no longer work on macOS? Can't get shortcut to show up in Shortcuts app
Was going to add a shortcut to an app via INIntent. I followed the WWDC developer.apple.com/videos/play/wwdc2021/10232/?time=986 Steps: Created a .intentdefinition file and created an intent. Added the intent to .intentdefinition and compiled the app. Import the header file for the custom intent in the AppDelegate MyIntentname.h Have the AppDelegate conform to the protocol created in the generated code. Implement: -application:handlerForIntent: and return self (the app delegate) Run the app. Open the Shortcuts app and search for the 'shortcut' (according to the WWDC video linked above it should show up in the actions list). Doesn't show up in the list. I tried moving the build application out from Debug to my Applications folder to see if that would help the Shortcuts app find it, but it didn't. Am I missing a step/doing something wrong?
2
0
116
May ’25
SMAppService getting notified when status changes externally (from System Settings)
Say I want to sync a toggle in my app with SMAppService's .status property. If the status changes from my app I can track it. But if user toggles it from System Settings, I don't see a notification so then the UI in my app is out of date. The status property is not key value observable and there doesn't appear to be a SMAppServiceStatusDidChangeNotification ? I can re-read it every time my app will become active but feels kind of wrong to do it this way.
2
0
79
May ’25
StoreKit2: Testing AppTransaction Receipt Verification?
I just boxed up AppTransaction API. In the debug environment it appears to always return a VerificationResult that is .verified Unlike Storekit1 calling AppTransaction.shared does not seem to cause a sandbox receipt to actually get written on the app bundle in Derived data. I was trying to purposefully mess with the receipt in order to get AppTransaction to fail so I can test how my app behaves when errors occur but there is no receipt to mess with. I tried using the old exit(173) API and it does cause a receipt to be fetched but that seems to be completely ignored by AppTransaction, it validates even if you trash or tamper with the receipt given by exit(173). Is there a good way to test receipt validation failure using the high level Storekit2 API?
2
1
208
Sep ’25
macOS Tahoe: NSView -cacheDisplayInRect:toBitmapImageRep: Doesn't Work Unless View is Added to Window
Previously I was able to "snapshot" view that were not part of any window hierarchy using the following: NSImage *buttonImage = [NSImage imageWithSystemSymbolName:@"49.circle.fill" accessibilityDescription:nil]; NSButton *aButton = [NSButton buttonWithImage:buttonImage target:nil action:nil]; [aButton sizeToFit]; NSBitmapImageRep *rep = [aButton bitmapImageRepForCachingDisplayInRect:aButton.bounds]; if (rep == nil) { NSLog(@"Failed to get bitmap image rep."); return; } [aButton cacheDisplayInRect:aButton.bounds toBitmapImageRep:rep]; NSData *tiffData = rep.TIFFRepresentation; NSImage *snapShotOfImage = [[NSImage alloc]initWithData:tiffData]; Now on macOS Tahoe I get a non nil image, but the image is blank. However if I add aButton NSWindow's view hiearchy just before the call to -cacheDisplayInRect:toBitmapImageRep: I do get a proper image. Is this behavior intended or is this considered a bug? Is it documented anywhere that a view must be in a NSWindow for -cacheDisplayInRect:toBitmapImageRep: to work? Thanks
Topic: UI Frameworks SubTopic: AppKit Tags:
2
0
92
3w
Why does AppStore.requestReview(in:) require NSViewController Parameter?
Looking to update one of my apps that uses SKStoreReviewController +requestReview (deprecated) to AppStore.requestReview(in:) umm...I have a few of questions... Why is an NSViewController parameter required? It's really not so uncommon for an AppKit app to just use NSWindowController with a window that does not use NSViewController... It should be possible to present the review request in a standalone alert (attached to a window is preferred IMO but it still should be possible to ask in separate window). 3)...why Swift..(err nevermind) Ideally: AppStore requestReview should take a NSWindow parameter but that parameter should be optional. If nil the request should be presented in a standalone window (like an alert). If non nil..present as a sheet on the window. Why a view controller? Maybe I'm missing something.
2
0
130
Oct ’25