Post

Replies

Boosts

Views

Activity

Undoing changes in Xcode doesn't remove compiler errors
It often happens that after a successful build I do some small changes that cause some compiler errors, but undoing those changes with Cmd-Z still leave the errors there. Building also doesn't remove them. Only cleaning the project and building again (which is very time consuming) or doing a small edit on the line that Xcode still thinks is wrong (such as adding a whitespace and immediately undoing it) finally gives a successful compilation again. I filed a bug report in September 2018, more than 3 years ago, and never got a response. Can it really be that I'm the only one experiencing this and why does it take so long to fix such annoying bugs and why does nobody care to give some reassurance that somebody is working on this?
0
0
398
Jan ’22
Table view inside navigation controller inside popover
First: is there a way of gracefully animating the popover's size to the size of the view controller pushed onto the navigation controller, like Pages does for the three dots menu? When setting the navigation controller's preferredContentSize inside the pushed table view controller's viewWillAppear, first the push animation is run, and when it finishes, the popover is resized. Second: how to get the correct size to set as preferredContentSize? That would probably be the table view's contentSize (which, unless calling reloadData(), is .zero in viewWillAppear) plus the navigation view's title bar height. How can one calculate this, without having to sum the different parts manually?
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
814
May ’22
Creating SCNGeometryElement with SCNGeometryPrimitiveType.polygon always causes error
I'm using this code to create a rectangle (that will eventually be a more complex shape): let vertices = [simd_float3(x: 1, y: 1, z: 0), simd_float3(x: 1, y: -1, z: 0), simd_float3(x: -1, y: -1, z: 0), simd_float3(x: -1, y: 1, z: 0)] let vertexSource = SCNGeometrySource(data: Data(bytes: vertices, count: MemoryLayout<simd_float3>.size * vertices.count), semantic: .vertex, vectorCount: vertices.count, usesFloatComponents: true, componentsPerVector: 3, bytesPerComponent: MemoryLayout<Float>.size, dataOffset: 0, dataStride: MemoryLayout<simd_float3>.stride) let indices: [Int32] = Array(0..<Int32(vertices.count)) let element = SCNGeometryElement(data: Data(bytes: indices, count: MemoryLayout<Int32>.size * indices.count), primitiveType: .polygon, primitiveCount: 1, bytesPerIndex: MemoryLayout<Int32>.size) let geometry = SCNGeometry(sources: [vertexSource], elements: [element]) which logs this error in the Xcode console: [SceneKit] Error: SCNGeometryElement initialization - Invalid polygon edge count (0) There also doesn't seem to be any documentation about how to use this .polygon mode. When using .triangleStrip with a primitiveCount of 2, no error is logged.
2
0
1.9k
May ’22
Error when reading NSAttributedString from UITextPasteItem
In order to support a custom paste behaviour, In my UITextView, which I set as its own UITextPasteDelegate in awakeFromNib(), I implemented textPasteConfigurationSupporting(_:,transform:). When pressing the paste button above the software keyboard, in the callback of item.itemProvider.loadItem(forTypeIdentifier: UTType.rtf.identifier) I get an error Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.rtf" UserInfo={NSLocalizedDescription=Cannot load representation of type public.rtf, NSUnderlyingError=0x28374e8e0 {Error Domain=PBErrorDomain Code=13 "Operation not authorized." UserInfo={NSLocalizedDescription=Operation not authorized.}}} even though the item.itemProvider.registeredTypeIdentifiers are "iOS rich content paste pasteboard type", "Apple Web Archive pasteboard type", "com.apple.uikit.attributedstring", "com.apple.rtfd", "com.apple.flat-rtfd", "public.utf8-plain-text", "public.rtf", "public.html", "com.apple.WebKit.custom-pasteboard-data" and item.itemProvider.canLoadObject(ofClass: NSAttributedString.self) returns true. Even item.itemProvider.loadObject(ofClass: NSAttributedString.self) returns a similar error: Error Domain=NSItemProviderErrorDomain Code=-1200 "Could not coerce an item to class NSAttributedString" UserInfo={NSLocalizedDescription=Could not coerce an item to class NSAttributedString, NSUnderlyingError=0x283497b70 {Error Domain=PBErrorDomain Code=13 "Operation not authorized." UserInfo={NSLocalizedDescription=Operation not authorized.}}}.
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
1.1k
Jun ’22
Trying to print NSAttributedString via many UITextViews causes crash
My Mac app uses many NSTextViews just fine for printing a long string, but trying to do the same on iOS with many UITextViews and associated UIViewPrintFormatters just causes a crash.*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]' *** First throw call stack: ( 0 CoreFoundation 0x00007fff23c7127e __exceptionPreprocess + 350 1 libobjc.A.dylib 0x00007fff513fbb20 objc_exception_throw + 48 2 CoreFoundation 0x00007fff23d03ab1 _CFThrowFormattedException + 194 3 CoreFoundation 0x00007fff23b83bf9 -[__NSArrayM objectAtIndex:] + 169 4 UIKitCore 0x00007fff48029503 -[UITextViewPrintFormatter rectForPageAtIndex:] + 86 5 UIKitCore 0x00007fff4806bc79 __57-[UIPrintPageRenderer drawPrintFormatter:forPageAtIndex:]_block_invoke + 41 6 UIKitCore 0x00007fff4806bcf9 __57-[UIPrintPageRenderer drawPrintFormatter:forPageAtIndex:]_block_invoke.43 + 29 7 libdispatch.dylib 0x000000010e4f6d48 _dispatch_client_callout + 8 8 libdispatch.dylib 0x000000010e505b24 _dispatch_async_and_wait_invoke + 175 9 libdispatch.dylib 0x000000010e4f6d48 _dispatch_client_callout + 8 10 libdispatch.dylib 0x000000010e504de6 _dispatch_main_queue_callback_4CF + 1500 11 CoreFoundation 0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 12 CoreFoundation 0x00007fff23bceca9 __CFRunLoopRun + 2329 13 CoreFoundation 0x00007fff23bce066 CFRunLoopRunSpecific + 438 14 GraphicsServices 0x00007fff384c0bb0 GSEventRunModal + 65 15 UIKitCore 0x00007fff48092d4d UIApplicationMain + 1621 16 myApp 0x000000010e1ca61b main + 75 17 libdyld.dylib 0x00007fff5227ec25 start + 1 18 ??? 0x0000000000000001 0x0 + 1 )Here's the code:class ViewController: UIViewController { override func viewDidAppear(_ animated: Bool) { let printController = UIPrintInteractionController.shared let printPageRenderer = PrintPageRenderer() printController.printPageRenderer = printPageRenderer printController.present(animated: true) } } class PrintPageRenderer: UIPrintPageRenderer { let layoutManager = NSLayoutManager() let textStorage = NSTextStorage(string: "fhdjksalhfj dskla fjf") var textViews = [UITextView]() override func prepare(forDrawingPages range: NSRange) { DispatchQueue.main.sync { for (i, textView) in textViews.enumerated() { let printFormatter = textView.viewPrintFormatter() addPrintFormatter(printFormatter, startingAtPageAt: i) } } } override var numberOfPages: Int { textStorage.addLayoutManager(layoutManager) let size = CGFloat(50) for _ in 0..&lt;2 { let textContainer = NSTextContainer(size: CGSize(width: size, height: size)) layoutManager.addTextContainer(textContainer) let textView = UITextView(frame: CGRect(x: 0, y: 0, width: size, height: size), textContainer: textContainer) textViews.append(textView) } return textViews.count } }My goal is printing a document from an attributed string and showing a custom header and footer on each page.
Topic: UI Frameworks SubTopic: UIKit Tags:
9
0
2k
Jul ’22
UITextView with custom NSUndoManager breaks auto-enabling of software keyboard undo button
I have a custom UITextView where entering text causes the undo button in the software keyboard to be enabled. When I override the undo manager like this: class TextView: UITextView { let _undoManager = UndoManager() override var undoManager: UndoManager? { return _undoManager } } the auto-enabling of the undo button doesn't work anymore. What is the correct way of providing my own undo manager?
Topic: UI Frameworks SubTopic: UIKit Tags:
1
1
767
Sep ’22
Confusing Metal family names
I'm trying to understand why my app produces weird drawings when using Metal instead of OpenGL on an old Mac Pro 2008. The system info says it belongs to macOS GPUFamily1 v3. A 2012 MacBook Pro, for which my app works fine with Metal, belongs to GPUFamily1 macOS 1. Does the first correspond to MTLFeatureSet.macOS_GPUFamily1_v3 and the second one to MTLGPUFamily.mac1 or something else? Would the second one be MTLFeatureSet.macOS_GPUFamily1_v4 or something else? The only commands I use for drawing are MTLRenderCommandEncoder.setVertexBytes(_:length:index:) , setFragmentTexture(_:index:) and drawPrimitives(type:vertexStart:vertexCount:). I think these are pretty basic commands that should work across all Metal versions, and the documentation doesn't say that they don't work on certain versions.
0
0
582
Oct ’22
How to access other users' home folder
My app allows scanning any selected directory, but I noticed that even when I enable Full Disk Access in the System Preferences, when enumerating the contents of any of the subdirectories of another user's home folder (Documents, Downloads etc.) a permission error is returned. Even when running the app from the Terminal with sudo nothing changes. Using sudo du works. Is this a limitation of macOS apps?
1
0
846
Oct ’22
Hide app that was launched on login on macOS 13 Ventura
Up until macOS 12, there was a checkbox labelled "Hide" for each login item in the Users & Groups System Preferences. Now in macOS 13 the login items have been moved to the General System Preferences, but the "Hide" checkbox has disappeared. Is there a way to know from within the app that it was launched as a login item, without offering an in-app "Launch at login" option which would allow me to control the whole process, but would be quite some effort to just replace that one little option?
1
0
931
Oct ’22
How to change the modification time of a directory on FAT32
I noticed that when copying files in the Finder to a FAT32 volume, the modification dates of directories show the current date, but when copying from the same FAT32 volume to my Mac the directory modification dates are preserved. Using the Terminal command touch -mt 202110251405 path_to_file where path_to_file points to a directory doesn't seem to work: the modification time stays the same as before. When path_to_file is a regular file, it works. Is this expected, or is there some limitation with FAT32 directories?
0
0
524
Oct ’22
Handoff with iCloud document-based app doesn't work
When tapping the Handoff icon of my app on the Mac or on the iPad, Xcode logs this error: [default personal] [ERROR] +[NSURL(BRAdditions) br_documentURLFromBookmarkableString:error:]: (passed to caller) error: Error Domain=BRCloudDocsErrorDomain Code=8 "Not Entitled" UserInfo={NSDescription=Not Entitled} When setting a breakpoint at NSApplicationDelegate.application(_:continue:restorationHandler:), I can see that userInfo.activityType is the one specified with the key NSUbiquitousDocumentUserActivityType under the Info.plist Document Types, but userActivity.userInfo is empty, so the document url is apparently not sent. Is there something else I have to set up?
1
0
1.6k
Nov ’22
Attachments from App Store Review cannot be downloaded
My app update won’t be accepted because apparently it contains a bug that causes a crash that I cannot reproduce. The review team uploaded a crash report on App Store Connect on September 27th, 2022, but ever since downloading it was not possible because of an App Store Connect bug. The corresponding Feedback Assistant report is also still open. So my update has now been held in queue for almost 4 months. Can anybody please speed this up? This is unacceptable.
0
0
570
Dec ’22
Adding regular expression find option to UITextView
I'm trying to implement a regular expression search in a UITextView with the UITextView.findInteraction introduced in iOS 16. The documentation shows a UIFindInteraction.optionsMenuProvider property and reads You use this closure to modify, augement or omit options from the default set available in UITextSearchOptions. But it's not clear how to actually modify the UITextSearchOptions, and where these options are even stored. And how would I omit options? How can the UIActions passed as the only argument to UIFindInteraction.optionsMenuProvider be distinguished from one another?
Topic: UI Frameworks SubTopic: UIKit Tags:
0
0
736
Dec ’22
Download individual iCloud file with progress callback
Is this possible and how? I've only seen examples about using NSMetadataQuery to search directories for files matching some predicate. I tried using this code let query = NSMetadataQuery() query.valueListAttributes = [NSMetadataUbiquitousItemPercentDownloadedKey] query.predicate = NSPredicate(value: true) let item = NSMetadataItem(url: url)! query.searchItems = [item] NotificationCenter.default.addObserver(forName: .NSMetadataQueryDidUpdate, object: query, queue: nil) { notification in     print(notification) } NotificationCenter.default.addObserver(forName: .NSMetadataQueryDidFinishGathering, object: query, queue: nil) { notification in     print(notification) } query.start() but this gives the following exception *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unknown kind of NSPredicate given to NSMetadataQuery (TRUEPREDICATE)' Without any predicate the query doesn't seem to start at all, like mentioned in the official documentation.
0
0
968
Jan ’23