Post

Replies

Boosts

Views

Activity

Replacing the NSLayoutManager for UITextView causes no text to be rendered in iOS 15
I have a simple project where I replace the NSLayoutManager for a UITextView initialized in a storyboard using UITextView.textContainer.replaceLayoutManager(…). On iOS 14.5, the layout manager is correctly replaced and the overridden drawUnderline function is called to correctly render the text using the subclassed NSLayoutManager. On iOS 15.2, none of the overridden functions in the NSLayoutManager subclass are being called, and no text is rendered in the UITextView. Custom NSLayoutManager: CaptionTextLayoutManager.swift ViewController: ViewController.swift Result (iOS 14.5 on the left, iOS 15.2 on the right): I think this is a regression in iOS 15 and not from my code, however I could be missing something.
0
0
1.5k
Mar ’22
Storyboard is not compiling and causing a crash if I open it in latest Xcode 15 release
I have a project with a fairly complex storyboard (~13k lines). The project builds fine with Xcode 14, both locally and on Xcode Cloud. However, on Xcode 15 Release (And also the last Beta version) opening the storyboard causes Xcode to crash, while trying to compile the project fails with a crash in ibtool. I've tried a few solutions to no avail. I've tried to isolate the build issue and try running ibtool locally to see if I get more output. This is what I get: /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --output-format human-readable-text Main.storyboard 2023-09-20 18:54:17.690 ibtoold[289:56283117] [MT] DVTAssertions: ASSERTION FAILURE in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot11/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEInterfaceBuilderCocoaTouch/IDEInterfaceBuilderCocoaTouch-22130/InterfaceBuilder/WidgetIntegration/IBUIAutolayoutGuide/IBUIViewAutolayoutGuideIntegration.m:481 Details: code which should be unreachable has been reached Object: <IBUIViewAutolayoutGuide: 0x6000068a6d00> Method: -ibPrimitiveAddConstraintsToCandidateListOnly:thatAreAlreadyInDocument: Thread: <_NSMainThread: 0x600001e241c0>{number = 1, name = main} Hints: Backtrace: 0 -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] (in DVTFoundation) 1 _DVTAssertionHandler (in DVTFoundation) 2 _DVTAssertionFailureHandler (in DVTFoundation) 3 -[IBUIViewAutolayoutGuide(IBUIViewAutolayoutGuideIntegration) ibPrimitiveRemoveConstraintsFromCandidateListOnly:keepingInDocument:] (in IDEInterfaceBuilderCocoaTouchIntegration) 4 -[NSView(IBViewIntegration) ibMoveCandidateConstraint:toParent:alreadyInDocument:] (in IDEInterfaceBuilderKit) 5 -[NSView(IBViewIntegration) ibVerifyConstraintsAreWellFormedInDocument:subarbitrationUnitCache:andPopulateMessages:] (in IDEInterfaceBuilderKit) 6 -[IBDocumentVerifier _verifyConstraintsAndPopulateMessages:] (in IDEInterfaceBuilderKit) 7 -[IBDocumentVerifier verifyAndPopulateMessages:] (in IDEInterfaceBuilderKit) 8 -[IBCocoaTouchDocumentVerifier verifyAndPopulateMessages:] (in IDEInterfaceBuilderCocoaTouchIntegration) 9 -[IBiOSDocumentVerifier verifyAndPopulateMessages:] (in IDEInterfaceBuilderiOSIntegration) 10 -[IBiOSStoryboardDocumentVerifier verifyAndPopulateMessages:] (in IDEInterfaceBuilderiOSIntegration) 11 __41-[IBDocumentVerifier performVerification]_block_invoke (in IDEInterfaceBuilderKit) 12 -[IBDocumentAutolayoutManager ignoreAutolayoutStatusInvalidationDuring:] (in IDEInterfaceBuilderKit) 13 -[IBDocument ignoreAutolayoutStatusInvalidationDuring:] (in IDEInterfaceBuilderKit) 14 -[IBDocumentVerifier performVerification] (in IDEInterfaceBuilderKit) 15 -[IBDocument performVerification] (in IDEInterfaceBuilderKit) 16 -[IBDocument readFromURL:ofType:error:] (in IDEInterfaceBuilderKit) 17 IBLoadDocument (in ibtoold) 18 -[IBCLIInterfaceBuilderToolPersona invokeArguments:outputDictionary:] (in ibtoold) 19 -[IBCLIInterfaceBuilderToolPersona runSingleInvocation:outputtingToFileHandle:andVerifyingEnvironment:] (in ibtoold) 20 IBCLIServerRunSingleInvocation (in ibtoold) 21 __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke_2 (in ibtoold) 22 __IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess_block_invoke (in ibtoold) 23 -[IBCLIErrorForwarder forwardErrorOutputToDescriptor:whileInvokingBlock:] (in ibtoold) 24 IBCLIServerRunSingleInvocationWithIODirectedAtPipesAndUnlinkOnSuccess (in ibtoold) 25 main (in ibtoold) 26 start (in dyld)
4
0
1.1k
Sep ’23
Lighting does not apply to model added to a USDZ file from an MDLAsset
Hi, I'm trying to display an STL model file in visionOS. I import the STL file using SceneKit's ModelIO extension, add it to an empty scene USDA and then export the finished scene into a temporary USDZ file. From there I load the USDZ file as an Entity and add it onto the content. However, the model in the resulting USDZ file has no lighting and appears as an unlit solid. Please see the screenshot below: Top one is created from directly importing a USDA scene with the model already added using Reality Composer through in an Entity and works as expected. Middle one is created from importing the STL model as an MDLAsset using ModelIO, adding onto the empty scene, exporting as USDZ. Then importing USDZ into an Entity. This is what I want to be able to do and is broken. Bottom one is just for me to debug the USDZ import/export. It was added to the empty scene using Reality Composer and works as expected, therefore the USDZ export/import is not broken as far as I can tell. Full code: import SwiftUI import ARKit import SceneKit.ModelIO import RealityKit import RealityKitContent struct ContentView: View { @State private var enlarge = false @State private var showImmersiveSpace = false @State private var immersiveSpaceIsShown = false @Environment(\.openImmersiveSpace) var openImmersiveSpace @Environment(\.dismissImmersiveSpace) var dismissImmersiveSpace var modelUrl: URL? = { if let url = Bundle.main.url(forResource: "Trent 900 STL", withExtension: "stl") { let asset = MDLAsset(url: url) asset.loadTextures() let object = asset.object(at: 0) as! MDLMesh let emptyScene = SCNScene(named: "EmptyScene.usda")! let scene = SCNScene(mdlAsset: asset) // Position node in scene and scale let node = SCNNode(mdlObject: object) node.position = SCNVector3(0.0, 0.1, 0.0) node.scale = SCNVector3(0.02, 0.02, 0.02) // Copy materials from the test model in the empty scene to our new object (doesn't really change anything) node.geometry?.materials = emptyScene.rootNode.childNodes[0].childNodes[0].childNodes[0].childNodes[0].geometry!.materials // Add new node to our empty scene emptyScene.rootNode.addChildNode(node) let fileManager = FileManager.default let appSupportDirectory = try! fileManager.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true) let permanentUrl = appSupportDirectory.appendingPathComponent("converted.usdz") if emptyScene.write(to: permanentUrl, delegate: nil) { // We exported, now load and display return permanentUrl } } return nil }() var body: some View { VStack { RealityView { content in // Add the initial RealityKit content if let scene = try? await Entity(contentsOf: modelUrl!) { // Displays middle and bottom models content.add(scene) } if let scene2 = try? await Entity(named: "JetScene", in: realityKitContentBundle) { // Displays top model using premade scene and exported as USDA. content.add(scene2) } } update: { content in // Update the RealityKit content when SwiftUI state changes if let scene = content.entities.first { let uniformScale: Float = enlarge ? 1.4 : 1.0 scene.transform.scale = [uniformScale, uniformScale, uniformScale] } } .gesture(TapGesture().targetedToAnyEntity().onEnded { _ in enlarge.toggle() }) VStack (spacing: 12) { Toggle("Enlarge RealityView Content", isOn: $enlarge) .font(.title) Toggle("Show ImmersiveSpace", isOn: $showImmersiveSpace) .font(.title) } .frame(width: 360) .padding(36) .glassBackgroundEffect() } .onChange(of: showImmersiveSpace) { _, newValue in Task { if newValue { switch await openImmersiveSpace(id: "ImmersiveSpace") { case .opened: immersiveSpaceIsShown = true case .error, .userCancelled: fallthrough @unknown default: immersiveSpaceIsShown = false showImmersiveSpace = false } } else if immersiveSpaceIsShown { await dismissImmersiveSpace() immersiveSpaceIsShown = false } } } } } #Preview(windowStyle: .volumetric) { ContentView() } To test this even further, I exported the generated USDZ and opened in Reality Composer. The added model was still broken while the test model in the scene was fine. This also further proved that import/export is fine and RealityKit is not doing something weird with the imported model. I am convinced this has to be something with the way I'm using ModelIO to import the STL file. Any help is appreciated. Thank you
0
0
638
Feb ’24
How can Picker or ColorPicker be used in a volumetric scenes in visionOS?
Hi, My app has a volumetric window displaying some 3D content for the user. I would like the user to be able to control the color of the material using a color picker displayed below the model in the same window, but unfortunately neither ColorPicker nor Picker are functional in volumetric scenes. Attempting to use them causes the app to crash with NSInternalInconsistencyException: Presentations are not permitted within volumetric window scenes. This seems rather limiting. Is there a way either of these components can be utilized? I could build a different "control panel" window but it would not be attached to the model window and it would get confusing if user has multiple 3d windows open. Thank you
3
2
1k
Feb ’24
Running application on 17.4 Simulator from Xcode 16.0 beta is crashing due to missing SwiftUICore.framework
Hi, I have a project that is pretty complex and includes mostly UIKit/Swift code with some SwiftUI added on top. I also have some SPM modules and internal Cocoapods libraries linking in. The project builds fine with the latest release version of Xcode (15) and runs on 17.4 simulator. WIth Xcode 16.0 Beta however, the project builds and runs fine on iOS 18 simulators, however there is a specific crash that happens at startup on iOS 17.4 simulators. Please see crash log below with the name of my application redacted: dyld[91294]: Library not loaded: /System/Library/Frameworks/SwiftUICore.framework/SwiftUICore Referenced from: <14C085D7-ECA8-3287-8038-5DE320ADCEBD> /Users/xxxxxx/Library/Developer/CoreSimulator/Devices/C23AA8A9-8475-4EE2-86B3-136A0EBCC362/data/Containers/Bundle/Application/95A49FCF-A7E3-4A8B-93F1-C4CDDBA74B60/xxxxxx.app/Frameworks/SwiftUI_Common.framework/SwiftUI_Common Reason: tried: '/Users/xxxxxx/Library/Developer/Xcode/DerivedData/xxxxxx-fglltpkbphqqjzgdgdadysinonmq/Build/Products/Debug-iphonesimulator/SwiftUICore.framework/SwiftUICore' (no such file), '/Users/xxxxxx/Library/Developer/Xcode/DerivedData/xxxxxx-fglltpkbphqqjzgdgdadysinonmq/Build/Products/Debug-iphonesimulator/PackageFrameworks/SwiftUICore.framework/SwiftUICore' (no such file), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file), '/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file, not in dyld cache), '/Library/Developer/CoreSimulator/Volumes/iOS_21E213/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 17.4.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/SwiftUICore.framework/SwiftUICore' (no such file) It seems like for some reason Xcode is building the app thinking there would be a SwiftUICore.framework on device, but since this framework is new in iOS 18 and does not exist on iOS 17.4, the system is unable to find it and crashes. I have the min deployment target set to iOS 14.5, so I'm not sure why Xcode would make the assumption that SwiftUICore.framework will be available for linking on runtime. Interestingly, I cannot reproduce this same issue on a clean project created using Xcode 16 and targeting min deployment of iOS 15. I was wondering if anyone has any suggestions regarding specific build settings to check and see where the issue might be coming from. Thanks
7
13
1.9k
Jun ’24
SPM Package resources bundle id format has changed in Xcode 16
I have a project that uses local SPM packages for modularization. In one of my local SPM packages I have a .storyboard file that gets packaged as a resource in the SPM package and consumed inside the parent. In Xcode 15.4, the resource bundle for my local SPM Package has the bundle id PackageName-TargetName-resources. I use this inside a parent storyboard to reference the storyboard from the SPM package. In Xcode 16, however, the resource bundle for my SPM Package gets assigned the bundle id packagename.TargetName.resources. This, of courses, introduces a crash in builds of my app done with Xcode 16 due to the incorrect bundle id. There is no documentation of this change that I could find by Apple or by the SPM team. Apple Team: There is a Feedback Report FB14803020 with the build files attached from Xcode 15.4 and Xcode 16. I cannot attach those here due to the public nature of this forum
2
1
499
Aug ’24