'Failed to finalize LSBundleWrapper' on SwiftUI app build for release
Asked Answered
E

3

16

I have a new app which I'm building to be cross platform using SwiftUI

When I build for release I get a very odd error in a popup generated by Xcode.

Unable To Install “nomadgo.ProductivityDashboard”

Please try again later.
Failed to finalize LSBundleWrapper mutator instance for

enter image description here

I only get this error one I build for release. I tried restarting my Macbook.

Specs:

Xcode Version 12.5.1 (12E507) MacBook Air (M1, 2020) BigSur

The app is fresh project using all latest Xcode settings for cross platform SwiftUI.

I get the error when trying to run the app on my MacBook.enter image description here

Elul answered 1/7, 2021 at 21:9 Comment(0)
M
24

I had exactly same issue. In my case deleting the project from Containers folder and cleaning the project in Xcode (⌘ + ⇧ + K) helped.

Metallic answered 7/7, 2021 at 17:25 Comment(5)
just clean is enoughSemiconscious
Where do I find that "Containers" folder?Hotze
Thanks to @m-karolczyk! Another way: XCode / Product / Clean Build FolderTerms
Clean isn't sufficient to resolve this on an M1 Ultra Mac Studio. Rebooted, blew away DerivedData, issue still persists. However, the same project on an M1 Pro MacBook Pro doesn't have the issue.Striped
@Hotze command line find "$HOME/Library" -name "*YourAppName*" 2> /dev/null in the Terminal will locate any Container folder(s) and other related locations.Equitation
P
4

Just in case, if you are still in this issue even after cleaning builds, check the Xcode Settings… > Locations > Derived Data path. The Derived Data path should be somewhere in your macOS boot drive.

Xcode 14.2 (14C18), Mac OS 12.5


In this "Failed to finalize LSBundleWrapper" scenario, the ProductName.app is not completely built. This case can be verified by checking the hidden product build folder "…/Build/Products/Debug-iphoneos/.XCInstall". The most significant missing piece is the lack of an executable:

Debug-iphoneos$ tree -a
.
└── .XCInstall
    └── ProductName.app
        ├── WrappedBundle -> Wrapper/ProductName.app
        └── Wrapper
            ├── BundleMetadata.plist
            └── ProductName.app
                ├── Icon.png
                ├── Info.plist
                └── PlaceholderEntitlements.plist

Xcode 14.3.1 (14E300c), Mac OS 13.4

Paderewski answered 20/12, 2022 at 1:12 Comment(2)
That was my problem as well. As I tend to have DerivedData on an external drive or a RAMDisk, this is a severe regression for me. Please join me in reporting a feedback.Mullin
I have my build stuff in a RAM Disk, as well. And it also never worked for me. To me this seems to be a proper solution (I have upvoted it). But I simply can't understand why Apple does a mayhem like that...Hotze
H
1

I resolved the issue by creating a CustomDerivedData folder anywhere in the Boot drive and set it as Custom Location for the DerivedData just for the projects that have this issue, setting it from File -> ProjectSettings... I can than continue to use the RAM/External disk for all the other projects that not are subjects to the issue.

Hus answered 24/4 at 8:23 Comment(1)
Yes. I also set the path of Derived Data to default and delete the previous Derived Data of my project. Then it runs fine.Stonecrop

© 2022 - 2024 — McMap. All rights reserved.