Flurry Analytics仍然不受MacCatalyst支持。在我的应用程序中,Flurry是该targetEnvironment中唯一不支持的CocoaPod。Fernando Moya de Rivas在Medium上发表了一篇关于这个问题的条件链接的好文章(https://medium.com/better-programming/macos-catalyst-debugging-problems-using-catalyst-and-cocoapods-579679150fa9)。pod是一个静态的预编译库。Moya de Rivas建议编辑xcconfig文件,如果文件仅来自iOS,则有条件地链接文件:
OTHER_LDFLAGS = $(inherited) -framework "Crashlytics" -framework "Fabric" -framework "FrameworkThatSupportsCatalyst"
至:
OTHER_LDFLAGS = $(inherited) -framework "FrameworkThatSupportsCatalyst"
OTHER_LDFLAGS[iphone*] = $(inherited) -framework "Crashlytics" -framework "Fabric"
因此,在我的xcconfig中,我从加载列表中删除了Flurry_iOS_SDK,并将其放在仅限iOS的列表中:
OTHER_LDFLAGS = $(inherited) -ObjC -framework "Accelerate" -framework "CFNetwork" -framework "CalmParametricAnimations" -framework "CampcotCollectionView" -framework "CoreGraphics" -framework "Foundation" -framework "KenBurns" -framework "Kingfisher" -framework "QuartzCore" -framework "Security" -framework "SystemConfiguration" -framework "UIKit"
OTHER_LDFLAGS[iphone*] = $(inherited) -framework "Flurry_iOS_SDK"
问题是Xcode似乎不喜欢条件链接语句:
xxxxxxx.debug.xcconfig Ignoring build settings configuration file Pods-HieroglyphicsPro.debug.xcconfig due to an error: String 'OTHER_LDFLAGS[iphone*] = $(inherited) -framework "Flurry_iOS_SDK"' could not be parsed: macro string representation 'OTHER_LDFLAGS[iphone*]' isn't well formed: parameter name is empty.
Moya de Rivas的方法被广泛引用为一个很好的解决方案,但我使用的是Xcode的更新版本(12.2版本12B45b(。是否不再支持此语法,或者我有一个看不到的语法错误?我找不到对Xcode链接器工具链的命令的引用。
OTHER_LDFLAGS[iphone*] = $(inherited) -framework "Flurry_iOS_SDK"
作为效果更好
OTHER_LDFLAGS[sdk=iphone*] = $(inherited) -framework "Flurry_iOS_SDK"