fermoya / cocoapods-catalyst-support

Ruby extensions to help you configure your pods project so that pods not compiled for Catalyst can still be used for iOS devices
MIT License
111 stars 18 forks source link

After including CatalystPodSupport I get error "Could not build Objective-C module 'Firebase'" on Mac app #7

Closed ericbenwa closed 4 years ago

ericbenwa commented 4 years ago

I'm guessing this is happening because I've successfully removed Firebase from the Mac app using this repo but it's still trying to import Firebase because it's listed in my ViewController.swift.

ViewController.swift import Firebase Error: "Could not build Objective-C module 'Firebase'"

and throughout ViewController.swift I am calling Analytics events that use Firebase. Analytics.logEvent("HelpOpen", parameters: nil)

Podfile of section listing unsupported pods: def catalyst_unsupported_pods [ "Crashlytics", "Fabric", "Firebase/Analytics", "Firebase/Core" ] end

If I'm removing Firebase from the Mac app, how do I handle the (disconnected for Mac) references to that pod in my ViewController?

Any thoughts or pointers? I'm new to Swift so not sure of what's available.

Note: Builds fine for iOS Simulator.

Thanks!

Screen Shot 2020-10-09 at 6 56 16 AM
fermoya commented 4 years ago

Hi @ericbenwa , if you see the documentation here you see you need to use compiler flags to avoid using that code in your ViewController:

#if !targetEnvironment(macCatalyst)
import Firebase
#endif

And then:

#if !targetEnvironment(macCatalyst)
// use Firebase functionality here
Analytics.logEvent("HelpOpen", parameters: nil)
#endif
ericbenwa commented 4 years ago

Ah, yes, thank you!

I'm an idiot, I just needed to scroll up a little more on the README. Was scouring too low and the Issues.