Conditional Pod linking for MacCatalyst

Viewed 166

Flurry Analytics is still not supported by MacCatalyst. In my App, Flurry is the only CocoaPod not supported in that targetEnvironment. Fernando Moya de Rivas had a nice article in Medium on conditional linking for this very problem (https://medium.com/better-programming/macos-catalyst-debugging-problems-using-catalyst-and-cocoapods-579679150fa9). The pod is a static, precompiled library. Moya de Rivas suggested editing the xcconfig file to conditionally link files if they were iOS only from:

OTHER_LDFLAGS = $(inherited) -framework "Crashlytics" -framework "Fabric" -framework "FrameworkThatSupportsCatalyst"

to:

OTHER_LDFLAGS = $(inherited) -framework "FrameworkThatSupportsCatalyst"
OTHER_LDFLAGS[iphone*] = $(inherited) -framework "Crashlytics" -framework "Fabric"

so, in my xcconfig, I removed Flurry_iOS_SDK from the load list and put it in the iOS only list:

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"

The problem is that Xcode does not seem to like the conditional link statement:

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' approach is widely quoted as a good solution, but I am using a later version of Xcode (12.2 release 12B45b). Is this syntax no longer supported, or do I have a syntax error I do not see? I was unable to find a reference to commands for the Xcode linker toolchain.

1 Answers
OTHER_LDFLAGS[iphone*] = $(inherited) -framework "Flurry_iOS_SDK"

works better as

OTHER_LDFLAGS[sdk=iphone*] = $(inherited) -framework "Flurry_iOS_SDK"
Related