Posts

Post not yet marked as solved
0 Replies
1.3k Views
Since iOS 13, apps can make use of a new Fonts entitlement, with a sub option 'Use Installed Fonts' to use custom fonts installed by special font provider apps. These apps make use of the same entitlement, but with sub option 'Install Fonts'. Examples of such apps are CreativeCloud from Adobe and MyFonts from MonoType. Using installed fonts works fine, except with WKWebView. As an example, I use the following code to load some text in a WKWebView control, and use a UIFontPickerViewController to select a font. After selecting the font, both the font of the webView control and navigation bar are being updated. This works fine with built-in system fonts. But after selecting a custom installed font, only the font of the navigation bar is being updated. This indicates that the app supports the installed custom font, but not the WKWebView control. class ViewController: UIViewController { &#9;&#9;@IBOutlet weak var webView: WKWebView! &#9;&#9;var font = "Avenir Next" &#9;&#9;let html = """ &#9;&#9;<style> &#9;&#9;body { &#9;&#9;&#9;&#9;font-family: 'FONTFAMILY'; &#9;&#9;&#9;&#9;font-size: 40pt; &#9;&#9;} &#9;&#9;</style> &#9;&#9;<body> &#9;&#9;This is a test string to demonstrate the characters of a custom installed font named “<b>FONTFAMILY</b>”. Hopefully it will not be replaced by Times New Roman or some other ugly looking font. &#9;&#9;</body> &#9;&#9;""" &#9;&#9;override func viewDidLoad() { &#9;&#9;&#9;&#9;super.viewDidLoad() &#9;&#9;&#9;&#9;loadHTML() &#9;&#9;} &#9;&#9;@IBAction func selectFont(_ sender: AnyObject) { &#9;&#9;&#9;&#9;let picker = UIFontPickerViewController() &#9;&#9;&#9;&#9;picker.delegate = self &#9;&#9;&#9;&#9;present(picker, animated: true, completion: nil) &#9;&#9;} &#9;&#9;fileprivate func loadHTML() { &#9;&#9;&#9;&#9;webView.loadHTMLString(html.replacingOccurrences(of: "FONTFAMILY", with: font), baseURL: nil) &#9;&#9;&#9;&#9;navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.font : UIFont(name: font, size: 24)!] &#9;&#9;} } extension ViewController: UIFontPickerViewControllerDelegate { &#9;&#9;func fontPickerViewControllerDidPickFont(_ viewController: UIFontPickerViewController) { &#9;&#9;&#9;&#9;if let family = viewController.selectedFontDescriptor?.object(forKey: .family) as? String&#9;&#9;&#9;{ &#9;&#9;&#9;&#9;&#9;&#9;font = family &#9;&#9;&#9;&#9;&#9;&#9;loadHTML() &#9;&#9;&#9;&#9;} &#9;&#9;} } Question: what must I do get those custom installed fonts working in WKWebView? An older technique of installing custom fonts in iOS made use of configuration profiles. This works perfectly with WKWebView, but my question is about the new iOS 13 font installation technique, as explained here: https://developer.apple.com/videos/play/wwdc2019/227/
Posted
by elemans.
Last updated
.
Post not yet marked as solved
0 Replies
228 Views
The default width of NSSearchToolbarItem is way too large. I want it to be similar to the Notes app. Is there an official way to do this? Setting maxSize seems to work, until I saw all kinds of layout constraint errors in the console while customising the toolbar, so that's apparently not the way to go.
Posted
by elemans.
Last updated
.
Post marked as solved
2 Replies
775 Views
My app uses CloudKit Query subscriptions and notifications as part of a CloudKit-based synchronization solution. This works perfectly with iOS 12, macOS 10.14 and even macOS 10.15 beta, but NOT with iOS 13.0, iOS 13.1 and TVOS 13.0.Is this a known problem?According to the documentation, nothing has changed with CloudKit subscriptions. Or did I miss something?
Posted
by elemans.
Last updated
.
Post not yet marked as solved
0 Replies
432 Views
The following code doesn't work anymore in Mojave:if let url = URL(string: "https://apple.com"), let listService = NSSharingService(named: NSSharingService.Name.addToSafariReadingList), listService.canPerform(withItems: [url]) { listService.perform(withItems: [url]) }The code is executed without any errors within the app, but nothing is being added to the Safari reading list. Please note that this code is just one of the many ways to show an 'Add to Reading List' item in an app. In all cases it won't work if it's 'third party' app.A lot of non-Apple apps that offer a 'Add to Reading List' share menu item, suffer from the same problem: nothing new appears in the Safari reading list.In the Console I saw a few errors indicating it is related to AppleEvent sandboxing, introduced in Mojave. So I added a NSAppleEventsUsageDescription item with a description to the Info.plist, but without any success.Does anyone know how to fix this problem?
Posted
by elemans.
Last updated
.
Post not yet marked as solved
2 Replies
680 Views
My macOS app uses a NSTableView with 'Floats Group Row' enabled. This works without problems on my test Macs. However, on a regular basis I receive crash reports titled: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'self.floatingGroupRowView should be equal to the given row view!'Does anyone know the conditions for this error?The last part of the crashlog look similar to this:0 CoreFoundation 0x00007fff51db6ff3 __exceptionPreprocess + 147 1 libobjc.A.dylib 0x00007fff78992c76 objc_exception_throw + 48 2 CoreFoundation 0x00007fff51dbcda2 +[NSException raise:format:arguments:] + 98 3 Foundation 0x00007fff53ebb260 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 192 4 AppKit 0x00007fff4f656e9f -[NSTableRowData _updateFloatingGroupRowView:row:] + 421 5 AppKit 0x00007fff4f4245db -[NSTableRowData _updateFrameRowView:row:] + 100 6 AppKit 0x00007fff4fd03fca __48-[NSTableRowData _doAutomaticRowHeightsForRows:]_block_invoke.1004 + 47 7 AppKit 0x00007fff4f40eae2 -[NSTableRowData enumerateAvailableRowViewsUsingBlock:] + 139 8 AppKit 0x00007fff4fd03ede -[NSTableRowData _doAutomaticRowHeightsForRows:] + 274 9 AppKit 0x00007fff4fd07157 __59-[NSTableRowData _automaticRowHeightsUpdateVisibleRowViews]_block_invoke.1494 + 141 10 AppKit 0x00007fff4fd06d05 -[NSTableRowData _keepTopRowStable:andDoWorkUntilDone:] + 535 11 AppKit 0x00007fff4fd07075 -[NSTableRowData _automaticRowHeightsUpdateVisibleRowViews] + 161 12 AppKit 0x00007fff4f415d85 -[NSTableRowData updateVisibleRowViews] + 261 13 AppKit 0x00007fff4f5bf24e -[NSTableRowData prepareContentInRect:] + 106 14 AppKit 0x00007fff4f5bed46 -[NSTableView prepareContentInRect:] + 303 15 AppKit 0x00007fff4fbbf7b1 __38-[NSView _pullInExtraTilesForOverdraw]_block_invoke + 562 16 AppKit 0x00007fff4f484a19 -[NSView _performWorkOnTilesFromRect:renderedContentRect:maximumRect:scrollVelocity:handler:] + 1544 17 AppKit 0x00007fff4f4841f2 -[NSView _pullInExtraTilesForOverdraw] + 854 18 AppKit 0x00007fff4f483e6d -[NSView _doIdlePrefetch] + 37
Posted
by elemans.
Last updated
.
Post not yet marked as solved
0 Replies
376 Views
I have a single-column NSTableView, populated with custom NSTableCellView's, very similar to the standard Mail app of macOS. Each custom NSTableCellView has a layout with four non-selectable read-only NSTextField's. VoiceOver for Accessibility reads things left to right, top to bottom. This results in a non-optimal order for VoiceOver users.How can I change the order in which VoiceOver reads the NSTextField's within each NSTableCellView?All examples and documentation I saw about re-ordering VoiceOver elements is related to iOS, but unfortunately the API in macOS is still different.
Posted
by elemans.
Last updated
.
Post not yet marked as solved
0 Replies
938 Views
Since macOS 10.13 we can use NSTableView with automatic row heights, thanks to the new property usesAutomaticRowHeights and of course auto layout. This works quite nicely.But when the user resizes a column, the calculated heights are no longer correct, and gaps appear in the tableview cells.Is there a proven way to update the row heights after column resize in this scenario?I already tried methods like updateConstraintsForSubtreeIfNeeded(), updateConstraints(), setNeedsDisplay(), reloadData() and so on, but nothing works.
Posted
by elemans.
Last updated
.