创建 XCFramework 找不到有效的框架

Creating XCFramework can't find a valid framework

我制作了空框架项目 MyFramework 并尝试创建 XCFramework

Xcode 12.3, 12.2, 11.7 macOS Catalina,大苏尔

在终端我写:

xcodebuild archive \
-project "MyFramework.xcodeproj" \
-scheme MyFramework \
-archivePath ~/Desktop/MyFramework-iphoneos.xcarchive \
-sdk iphoneos \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES

生成MyFramework-iphoneos.xcarchive成功

但是当我在终端中写入时:

xcodebuild -create-xcframework -framework '~/Desktop/MyFramework-iphoneos.xcarchive/Products/Library/Frameworks/MyFramework.framework' -output '~/Desktop/MyFramework.xcframework'

它returns错误:

error: the path does not point to a valid framework: ~/Desktop/MyFramework-iphoneos.xcarchive/Products/Library/Frameworks/MyFramework.framework

是什么原因以及如何解决?

问题似乎出在诸如“~/Desktop”之类的相对路径中 改用“users/username/documents...”解决了这个问题