Post

Replies

Boosts

Views

Activity

Reply to I get "Failed to prepare device for development." on my iPhone for development
I'm running iOS 15.1 (19B74) on an iPhone 13 Pro Max., and XCode 13.1 I was having this problem. Taking a hint from an answer above (in this thread), I checked KeyChain Access -> Certificates and I found duplicated Apple Worldwide Developer Relations Certificate Authority, one expiring in 2023, and another expiring in 2030. I deleted the 2023 one. I also saw some expired developer certificates/authorities, and got rid of those. I double clicked a few of the certs I know I trust and set the trust dropdown selection from "Use system defaults" to "trust". All that resolved it. Maybe that entailed more than I needed to to resolve it, but it works now.
Oct ’21
Reply to UITableViewAlertForLayoutOutsideViewHierarchy
Before you you resort to the clever but dangerous trick (shown in some of the answers) that masks the error by overriding the layoutSubviews() method of the table delegate or controller, I'd advise reviewing fundamentals and related documentation for how the table view is constructed and invoked, particularly if a navigation stack is involved. Make sure you're applying the right design pattern in the first place before trying to tackle the obscure downstream consequences of using the wrong paradigm, like I did. This error was happening to me when I erroneously configured a UITableView delegate (UIViewController) as a tab on the app's root view controller, which I'd made a UITabBarController. In addition to the message quoted in the original question, I was seeing controller "not pushed " errors in the XCode console. The problems went away after I implemented the approach documented in Apple's document "Combined View Controller Interfaces" My incorrect approach had been to add the UITableView delegate (UIViewController) directly to the tab bar controller, then use performSegue() in the table delegate's 'didSelect' for index method. I was also using performSegue() as the action of the "+" icon I added to the UINavigationItem (which I obtained from the navigationItem property of UIViewController). The segues invoked the next viewController I'd written to handle (or create) table-related items. The proper way to do it is to instead add a UINavigationController to the tab bar, not the table view delegate (or table view controller) to the tab bar. Then, add the table view delegate (or table view controller) to the navigation controller. And instead of using performSegue() in the table view delegate's "didSelectRowAt" method use navigationController?.pushViewController() (same for invoking the next navigation item based controller from a button outside the table view instead of a row inside). Of course the proper way makes more sense, particularly since since my table view was playing with the UINavigationItem components and had configured itself to be used with a navigation bar anyway. One other note: The error message shown in the question mentions adding a symbolic breakpoint to a certain method to see what's causing the problem. Of course that stops the code and shows a screen with assembly language that will be completely inscrutable to people working with distribution libraries instead of iOS source code that Apple insider's use. So if you try that, you'll want to use 'bt' at the lldb prompt to get the stack backtrace. In my case, all it showed me was that everything started with a tab button press and looked normal and expected. So the problem in my case just came down to a noob ignorance about how some of the pieces go together.
Apr ’22
Reply to NSExtension Warning
This code in my app generates those console messages. I suspect that message is a warning to internal iOS developers to adapt to some change or deprecation and for the time being doesn't affect us and nothing we can do about it but not sure. Some of the messages might be related to the data I'm trying to save... I might not have it right.    @objc func shareButtonPressed() {         do {             let filename = title + "-notes"             let ext = "rtf"             let rtfURL = try FileManager.default.url(for: .documentDirectory,                                                       in: .userDomainMask,                                           appropriateFor: nil,                                                   create: false) .appendingPathComponent(filename + "." + ext)             try attrText.rtf().write(to: rtfURL)             let activityViewController = UIActivityViewController(activityItems: [rtfURL], applicationActivities: nil)             present(activityViewController, animated: true, completion: {})         } catch {             print(error)         }     } > CopresenceCore.Entitlement.publicAPI error nil 2022-05-17 13:12:01.397911-0700 UsefulApp[95056:24788961] [LayoutConstraints] Changing the translatesAutoresizingMaskIntoConstraints property of a UICollectionReusableView that is managed by a UICollectionView is not supported, and will result in incorrect self-sizing. View: <_UIActivityContentFooterView: 0x122548330; baseClass = UICollectionReusableView; frame = (20 298; 388 52); layer = <CALayer: 0x6000010c7a20>> 2022-05-17 13:12:01.555156-0700 UsefulApp95056:24789409] [Fetching] LPFileMetadataProviderSpecialization failed to retrieve a thumbnail from QuickLookThumbnailing (Error Domain=QLThumbnailErrorDomain Code=0 "Could not generate a thumbnail") 2022-05-17 13:13:12.303430-0700 UsefulApp[95056:24788961] [NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must implement `+_allowedItemPayloadClasses`. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error. Extension: <EXConcreteExtension: 0x60000253c540> {id = com.apple.DocumentManagerUICore.SaveToFiles} Items: (     "<NSExtensionItem: 0x6000012100a0> - userInfo: {\n    NSExtensionItemAttachmentsKey =     (\n        \"<NSItemProvider: 0x600003b63870> {types = (\\n    \\\"public.rtf\\\",\\n    \\\"public.file-url\\\"\\n)}\"\n    );\n    \"com.apple.UIKit.NSExtensionItemUserInfoIsContentManagedKey\" = 0;\n}" ) 2022-05-17 13:13:23.920403-0700 UsefulApp[95056:24788961] [ShareSheet] cancelled request - error: The operation was cancelled. 2022-05-17 13:13:29.193851-0700 UsefulApp[95056:24790618] [ShareSheet] connection invalidated
May ’22
Reply to Version 14.0 beta (14A5228q) - extremely laggier for me than XCode 13 release
It doesn't happen with a smaller project, just the larger project I am working on so it's something about the code, which is very smooth editing and quick to compile on XCode 13. I just found this this in the XCode 14 release notes, known issues: "In macOS 12, first launch of Xcode 14 takes several minutes due to a validation scan. (89992778)" I'm not sure if that's the issue. I now have launched XCode, opened that project and will set it in another window and develop on XCode 13 and check back to see if it is a validation scan that will eventually complete. But so far it's too slow and choppy in time slices to use.
Jun ’22
Reply to Present UIMenu programatically
In iOS 16 (and possibly prior), you can use UIAlertController with preferredStyle set to .actionSheet. Create a UIAlertAction for each option and add each action to the UIAlertController object. Then you can present the UIAlertController like you might with any other view controller with UIViewController.present(...) As per the example below you can cause the selection action to call back to the object that configures the alert to notify of the selection. let option1 = UIAlertAction(title: "Option 1", style: .default) { [weak self] _ in self?.handleOptionSelection("Option 1") } Although UIAlertController is a subclass of UIViewController, there are limitations about what you can do if you use that class however, as Apple says it's not designed for subclassing nor are its private methods intended to be used by apps. If you need to customize the appearance quite a bit, you may have to do some more leg work and use a custom view controller for the pop-up content and a UIPresentationController to handle the presentation and dismissal.
Mar ’23
Reply to UIToolbar issue in iOS 13
YUP! That's what it took, let toolbar = UIToolbar(frame: CGRectMake(0, 0, UIScreen.main.bounds.size.width, 20) toolbar.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ . . . ]) The frame is wider than it needs to be (constraints use safe area layout guides), but it seems to work as intended with autolayout.
May ’23