SwingAnimation
SwingAnimation copied to clipboard
使用过程中找不到 ClockHandRotationKit
我在使用过程中遇到两个问题:
- 使用 SPM 集成的情况下,我发现我必须在宿主 App 的
Link Binary with Libraries中添加SwingAnimation,否则,在运行小组件的时候,会提示找不到 ClockHandRotationKit:
dyld[18266]: Library not loaded: @rpath/ClockHandRotationKit.framework/ClockHandRotationKit
Referenced from: /private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/MyWidgetExtension
Reason: tried: '/usr/lib/swift/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/../../Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/usr/lib/swift/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/private/var/containers/Bundle/Application/ED21F8A4-CCBE-429D-9019-70193AF27BF0/MyHostApp.app/PlugIns/MyWidgetExtension.appex/../../Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/System/Library/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file)
但是,如果我在宿主 App 中添加了这个的话,由于我们的 App 需要支持iOS 12和iOS 13,在这些设备上运行就会crash:
dyld: warning: could not load inserted library '/System/Library/PrivateFrameworks/GPUToolsCapture.framework/GPUToolsCapture' into hardened process because image not found
dyld: Library not loaded: /System/Library/Frameworks/WidgetKit.framework/WidgetKit
Referenced from: /private/var/containers/Bundle/Application/7A3242AE-A045-4377-BC7D-9875D932ACBB/WDBuyerUniv.app/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit
Reason: image not found
此外,由于众所周知的原因,SPM 的包经常拉不下来,于是,我就将它制作成 pod:
Pod::Spec.new do |s|
s.name = 'MySwingAnimation'
s.version = '0.1.0'
s.summary = 'A short description of MySwingAnimation.'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://gitlab.xxxx.net/xxx/MySwingAnimation'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'xxx' => '[email protected]' }
s.source = { :git => 'ssh://[email protected]/xxx//MySwingAnimation.git', :tag => s.version.to_s }
s.ios.deployment_target = '12.0'
s.source_files = 'MySwingAnimation/Classes/**/*'
s.swift_versions = ['5.1', '5.2', '5.3', '5.4', '5.5','5.9']
s.vendored_frameworks = 'Frameworks/ClockHandRotationKit.xcframework'
s.xcconfig = { 'EXCLUDED_ARCHS' => 'armv7','BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }
s.attributes_hash['extended'] ||= {'cocoapods-binary-source-swithcer' => '~> 1.0.0', "is_xcframework" => "true"}
end
打包成 XCFramewwork 之后,针对小组件引入依赖 MySwingAnimation , 运行时还是出现了类似的错误:
dyld[18355]: Library not loaded: @rpath/ClockHandRotationKit.framework/ClockHandRotationKit
Referenced from: /private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/MyWidgetExtension
Reason: tried: '/usr/lib/swift/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/../../Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/usr/lib/swift/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/private/var/containers/Bundle/Application/429403CF-8F9D-4CE4-B98D-4D856A5692D2/MyHostApp.app/PlugIns/MyWidgetExtension.appex/../../Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file),
'/System/Library/Frameworks/ClockHandRotationKit.framework/ClockHandRotationKit' (no such file)