pmusolino / Wormholy

iOS network debugging, like a wizard 🧙‍♂️
MIT License
2.36k stars 189 forks source link

Error in Xcode 14.1 via Carthage #126

Closed kamilw-au closed 1 year ago

kamilw-au commented 2 years ago

Hello, I'm getting an error when trying to build Wormholy via Carthage in Xcode 14.1:


A shell task (/usr/bin/xcrun xcodebuild -project /Users/Test-user/Documents/test-project/Carthage/Checkouts/Wormholy/Wormholy.xcodeproj -scheme Wormholy-macOS -configuration Release CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -showBuildSettings -skipUnavailableActions) failed with exit code 6:
2022-11-25 15:53:29.889 xcodebuild[45140:418348] [MT] DVTAssertions: ASSERTION FAILURE in /System/Volumes/Data/SWE/Apps/DT/BuildRoots/BuildRoot1/ActiveBuildRoot/Library/Caches/com.apple.xbs/Sources/IDEFrameworks/IDEFrameworks-21534.1/IDEFoundation/Execution/RunDestinations/IDERunDestinationCLI.m:566
Details:  Unhandled/unexpected case where no run destinations were produced.
Object:   <IDERunDestinationCLI>
Method:   +resolveRunDestinationsWithWorkspace:scheme:buildAction:schemeCommand:schemeTask:destinationSpecifications:architectures:timeout:runDestinationManager:deviceManager:fallbackPreferredSDK:fallbackPreferredArchitectures:skipUnsupportedDestinations:shouldSkipRunDestinationValidation:didDisambiguate:disambiguatedMatches:disambiguatedMatchesDescription:error:
Thread:   <_NSMainThread: 0x600001400280>{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   _sortDevicesForDisplay (in IDEFoundation)
  4   -[Xcode3CommandLineBuildTool _resolveRunDestinationsForBuildAction:] (in Xcode3Core)
  5   -[Xcode3CommandLineBuildTool _resolveInputOptionsWithTimingSection:] (in Xcode3Core)
  6   -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
  7   XcodeBuildMain (in libxcodebuildLoader.dylib)
  8   start (in dyld)
vault087 commented 1 year ago

Facing the same issue, is there any fix for that?

hanishassim commented 1 year ago

I guess the library no longer actively maintained its been 11 months since this this issue first reported, and I also am facing the same issue

pmusolino commented 1 year ago

Hello there. I'm so sorry you were experiencing this issue with Carthage. This should be fixed in the latest release 1.7.0. https://github.com/pmusolino/Wormholy/releases/tag/1.7.0

This error occurred because of a change in Xcode 12, which made the simulator build also include the arm64 architecture (for Apple Silicon Macs). This is causing a conflict because now both the device and simulator builds have the same architecture, and they can't be merged into one fat framework.

The error message suggests a solution: rebuild with --use-xcframeworks to create an xcframework bundle instead.

You can do this by running the following command:

carthage update --use-xcframeworks

This will tell Carthage to build xcframeworks instead of universal (fat) frameworks. XCFrameworks is a new format that supports multiple architectures, platforms, and simulator/device slices in a single bundle, which solves the problem you're seeing.

After running this command, you'll need to update your project to link against the .xcframework bundles instead of the old .framework bundles. You can do this in the "Frameworks, Libraries, and Embedded Content" section of the "General" tab in your target settings in Xcode.

I can provide more detail about how to link against the .xcframework bundles in Xcode. Here are the steps:

  1. Open your Xcode project: Double-click the .xcodeproj or .xcworkspace file to open your project in Xcode.

  2. Select your target: In the project navigator on the left side of the Xcode window, click on the top-level project file (the one with the blue icon). In the panel that appears, click on your target under the "Targets" section. This will typically be the name of your app.

  3. Go to the "General" tab: In the panel on the right side of the window, click on the "General" tab.

  4. Remove the old .framework bundle: In the "Frameworks, Libraries, and Embedded Content" section, you'll see a list of all the frameworks and libraries that your app links against. Find the old .framework bundle (it will have the same name as the .xcframework bundle, but without the .xcframework extension). Click on it to select it, then click the "-" button below the list to remove it.

  5. Add the .xcframework bundle: Now you'll add the .xcframework bundle. Click the "+" button below the list of frameworks and libraries. In the dialog that appears, navigate to the location where the .xcframework bundle was created (this will typically be in the Carthage/Build directory in your project folder). Select the .xcframework bundle and click "Open".

  6. Link the .xcframework bundle: The .xcframework bundle will now appear in the list of frameworks and libraries. Make sure that the "Embed & Sign" option is selected in the dropdown menu next to the .xcframework bundle. This ensures that the .xcframework bundle will be embedded in your app bundle and will be correctly signed with your app's signature.

Now your project is set up to link against the .xcframework bundle instead of the old .framework bundle. You can build and run your project to make sure everything works correctly. If you encounter any issues, the error messages in Xcode should give you some clues about what's going wrong.

pmusolino commented 1 year ago

Attaching a TestProject in case you want to test this change.

TestProject.zip