iOS之制作xcframework摘录

========================

最近RxSwift 6开始需要xcframework拖到工程中(感觉有点麻烦,直接让我们pod就能用,他不香吗),然后我就去搜了网上的教程制作xcframework,真是很麻烦,幸好结合下面两篇教程最后还是搞定了。

附网址:https://www.shareintelli.com/1087/
附网址:https://blog.csdn.net/zr_csdn/article/details/112298965


截图看不到的命令行

xcodebuild -create-xcframework -framework <第一个库的路径> -framework <第二个库的路径> -output <输出路径/库名称.xcframework>
xcodebuild -create-xcframework -framework /Users/admin/Library/Developer/Xcode/DerivedData/MyTools-ciyqnqacjemhpfbqswwhrlyvstsb/Build/Products/Release-iphoneos/MyTools.framework -framework /Users/admin/Library/Developer/Xcode/DerivedData/MyTools-ciyqnqacjemhpfbqswwhrlyvstsb/Build/Products/Release-iphonesimulator/MyTools.framework -output ~/Desktop/MyToolsOutput/MyTools.xcframework

// 成功后的日志
xcframework successfully written out to: /Users/admin/Desktop/MyToolsOutput/MyTools.xcframework

工作记录

这里因为在博客就直接给内容哈:

Last login: Sun Mar 21 16:16:57 on ttys000
zhangsaidong@zhangsaidongs-MacBook-Pro ~ % cd /Users/zhangsaidong/Desktop/project2/iOS/someProject
zhangsaidong@zhangsaidongs-MacBook-Pro someProject % 
zhangsaidong@zhangsaidongs-MacBook-Pro someProject % git clone https://github.com/ReactiveX/RxSwift.git
Cloning into 'RxSwift'...
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 39525 (delta 9), reused 9 (delta 3), pack-reused 39489
Receiving objects: 100% (39525/39525), 15.15 MiB | 1.85 MiB/s, done.
Resolving deltas: 100% (29174/29174), done.
zhangsaidong@zhangsaidongs-MacBook-Pro someProject % xcodebuild
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild

xcodebuild: error: The directory /Users/zhangsaidong/Desktop/project2/iOS/someProject does not contain an Xcode project.

zhangsaidong@zhangsaidongs-MacBook-Pro someProject % cd /Users/zhangsaidong/Desktop/project2/iOS/someProject/RxSwift/RxExample/RxExample.xcodeproj
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample.xcodeproj % cd ..
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcode build
zsh: command not found: xcode
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild

note: Using new build system
note: Planning build
note: Constructing build description
warning: ONLY_ACTIVE_ARCH=YES requested with multiple ARCHS and no run destination to provide an active architecture; building for all applicable architectures (in target 'RxCocoa' from project 'Rx')
error: No profiles for 'io.rx.example.4.3.0' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'io.rx.example.4.3.0'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'RxExample-iOS' from project 'RxExample')
error: Building for iOS, but the linked framework 'RxSwift.framework' is building for macOS. You may need to configure 'RxSwift.framework' to build for iOS. (in target 'RxExample-iOS' from project 'RxExample')
error: Building for iOS, but the linked framework 'RxCocoa.framework' is building for macOS. You may need to configure 'RxCocoa.framework' to build for iOS. (in target 'RxExample-iOS' from project 'RxExample')

zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxCocoa.framework  -framework/Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphonesimulator/RxCocoa.framework
error: invalid argument '-framework/Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxCocoa.framework'.
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxCocoa.framework  -framework/Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphonesimulator/RxCocoa.framework -output ~/Desktop/RxCocoa.xcframework
error: invalid argument '-framework/Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxCocoa.framework'.
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxCocoa.framework  -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphonesimulator/RxCocoa.framework -output ~/Desktop/RxCocoa.xcframework
xcframework successfully written out to: /Users/zhangsaidong/Desktop/RxCocoa.xcframework
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxRelay.framework
error: no output was specified.
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxRelay.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxRelay.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphonesimulator/RxRelay.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-appletvos/RxRelay.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-watchos/RxRelay.framework output ~/Desktop/RxRelay.xcframework
error: invalid argument 'output'.
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxRelay.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxRelay.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphonesimulator/RxRelay.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-appletvos/RxRelay.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-watchos/RxRelay.framework -output ~/Desktop/RxRelay.xcframework
xcframework successfully written out to: /Users/zhangsaidong/Desktop/RxRelay.xcframework
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-appletvos/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxCocoa.framework
error: no output was specified.
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-appletvos/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphonesimulator/RxCocoa.framework
error: no output was specified.
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-appletvos/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphonesimulator/RxCocoa.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-watchos/RxCocoa.framework -output ~/Desktop/RxCocoa.xcframework
xcframework successfully written out to: /Users/zhangsaidong/Desktop/RxCocoa.xcframework
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample % xcodebuild -create-xcframework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release/RxSwift.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-appletvos/RxSwift.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphoneos/RxSwift.framework  -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-iphonesimulator/RxSwift.framework -framework /Users/zhangsaidong/Library/Developer/Xcode/DerivedData/RxExample-dzmpynlazvvqfffzdantespvadrq/Build/Products/Release-watchos/RxSwift.framework  -output ~/Desktop/RxSwift.xcframework
xcframework successfully written out to: /Users/zhangsaidong/Desktop/RxSwift.xcframework
zhangsaidong@zhangsaidongs-MacBook-Pro RxExample %