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

[BUG] AdColony doesn't get removed #36

Open houmie opened 2 years ago

houmie commented 2 years ago

This is an amazing project. Thanks for the hard work you have put into this.

AdColony doesn't get properly filtered out I have come across an anomaly with removing Google Admob and its dependencies.

The verbose message below looks good to me. In theory it's finding all the incompatible libraries, but in practice I still can't build the project. The error I'm getting is: ld: framework not found AdColony

Analyzing dependencies
Downloading dependencies
Generating Pods project

#### Configuring macos dependencies ####

#### Unsupported Libraries ####
["Google-Mobile-Ads-SDK", "GoogleMobileAdsMediationAdColony", "GoogleUserMessagingPlatform", "AdColony"]

#### Unsupported dependencies ####
["AVFoundation", "AdColony", "AdSupport", "AudioToolbox", "CoreMedia", "CoreServices", "JavaScriptCore", "MessageUI", "SafariServices", "AppTrackingTransparency", "Social", "StoreKit", "WatchConnectivity", "WebKit", "CFNetwork", "CoreVideo", "MediaPlayer", "MobileCoreServices", "Google-Mobile-Ads-SDK", "GoogleMobileAdsMediationAdColony", "GoogleUserMessagingPlatform", "GoogleMobileAds", "AdColonyAdapter", "UserMessagingPlatform"]

#### Frameworks not to be included in the Archive ####
["AVFoundation.framework", "AdColony.framework", "AdSupport.framework", "AudioToolbox.framework", "CoreMedia.framework", "CoreServices.framework", "JavaScriptCore.framework", "MessageUI.framework", "SafariServices.framework", "AppTrackingTransparency.framework", "Social.framework", "StoreKit.framework", "WatchConnectivity.framework", "WebKit.framework", "AVFoundation.framework", "AdColony.framework", "AdSupport.framework", "AudioToolbox.framework", "CFNetwork.framework", "CoreMedia.framework", "CoreServices.framework", "CoreVideo.framework", "JavaScriptCore.framework", "MediaPlayer.framework", "MessageUI.framework", "MobileCoreServices.framework", "SafariServices.framework", "WebKit.framework", "AdSupport.framework", "AppTrackingTransparency.framework", "JavaScriptCore.framework", "SafariServices.framework", "Social.framework", "StoreKit.framework", "WatchConnectivity.framework", "WebKit.framework", "WebKit.framework", "AdSupport.framework", "AdColony.framework", "Google-Mobile-Ads-SDK.framework", "GoogleMobileAdsMediationAdColony.framework", "GoogleUserMessagingPlatform.framework", "AdColony.framework", "AdColony.framework", "AdSupport.framework", "AudioToolbox.framework", "AVFoundation.framework", "CoreMedia.framework", "JavaScriptCore.framework", "MessageUI.framework", "CoreServices.framework", "SafariServices.framework", "GoogleMobileAds.framework", "AudioToolbox.framework", "AVFoundation.framework", "CFNetwork.framework", "CoreMedia.framework", "CoreVideo.framework", "MediaPlayer.framework", "MessageUI.framework", "MobileCoreServices.framework", "AdColonyAdapter.framework", "UserMessagingPlatform.framework", "WebKit.framework"]

#### Resources not to be included in the Archive ####
[]

#### Flagging unsupported libraries ####
    Target: AdColony
        Scheme: Release
            Succeded
        Scheme: Debug
            Succeded
    Target: CryptoSwift-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FBAEMKit
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FBSDKCoreKit
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FBSDKCoreKit_Basics
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FBSDKShareKit
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: Firebase-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FirebaseABTesting-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FirebaseAnalytics-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FirebaseCore-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FirebaseCoreDiagnostics-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FirebaseCrashlytics-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FirebaseInstallations-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: FirebaseRemoteConfig-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: Google-Mobile-Ads-SDK
        Scheme: Release
            Succeded
        Scheme: Debug
            Succeded
    Target: GoogleAppMeasurement-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: GoogleDataTransport-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: GoogleMobileAdsMediationAdColony
        Scheme: Release
            Succeded
        Scheme: Debug
            Succeded
    Target: GoogleUserMessagingPlatform
        Scheme: Release
            Succeded
        Scheme: Debug
            Succeded
    Target: GoogleUtilities-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: IQKeyboardManagerSwift
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: KeychainAccess-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: Keys-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: MMWormhole-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: OpenVPNAdapter-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: PromisesObjC-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: SSZipArchive-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: SwiftyBeaver-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: lottie-ios
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: nanopb-iOS
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: Pods-intent-ios
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag
    Target: Pods-myProject
        Scheme: Release
            Succeded
        Scheme: Debug
            Succeded
    Target: Pods-myProject-myProjectUITests
        Scheme: Release
            Succeded
        Scheme: Debug
            Succeded
    Target: Pods-myProjectTests
        Scheme: Release
            Succeded
        Scheme: Debug
            Succeded
    Target: Pods-tunnel-ios
        Scheme: Release
            Nothing to flag
        Scheme: Debug
            Nothing to flag

#### Filtering build phases ####

#### Filtering dependencies ####
    Target: AdColony
        - Filtering dependencies
    Target: Google-Mobile-Ads-SDK
        - Filtering dependencies
    Target: GoogleMobileAdsMediationAdColony
        - Filtering dependencies
    Target: GoogleUserMessagingPlatform
        - Filtering dependencies

#### Changing frameworks and resources script ####
    Target: Pods-intent-ios
        -Uninstalling frameworks
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
        -Uninstalling resources
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
    Target: Pods-myProject
        -Uninstalling frameworks
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
        -Uninstalling resources
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
    Target: Pods-myProject-myProjectUITests
        -Uninstalling frameworks
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
        -Uninstalling resources
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
    Target: Pods-myProjectTests
        -Uninstalling frameworks
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
        -Uninstalling resources
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
    Target: Pods-tunnel-ios
        -Uninstalling frameworks
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
        -Uninstalling resources
            Uninstalling for configurations: ["Release", "Debug"]
            Nothing to uninstall
Catalyst => Done! Your Catalyst dependencies are ready to go
Integrating client project
Pod installation complete! There are 15 dependencies from the Podfile and 30 total pods installed.

Podfile

require 'cocoapods-catalyst-support'

def shared_pods
  pod 'MMWormhole'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Analytics'
  pod 'Firebase/Crashlytics'
  pod 'SSZipArchive'
  pod 'KeychainAccess'
  pod 'SwiftyBeaver'
  pod 'CryptoSwift'
  pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.8.0'
end

plugin 'cocoapods-keys', {
  :project => "myProject",
  :keys => [
    "ApiTokenStag",
    "ProfileTokenStag",
    "ApiTokenProd",
    "ProfileTokenProd",
    "ApiUrlProd",
    "ApiUrlProdMac",
    "loggerToken"
  ]}

target 'myProject' do
  # Comment the next line if you don't want to use dynamic frameworks
  platform :ios, '12.0'
  use_frameworks!
  shared_pods

  # Pods for myProject
  pod 'lottie-ios'
  pod 'IQKeyboardManagerSwift'
  pod 'FBSDKShareKit'
  pod 'Google-Mobile-Ads-SDK'
  pod 'GoogleMobileAdsMediationAdColony'
# pod 'GoogleMobileAdsMediationTestSuite'
  target 'myProjectTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'myProjectUITests' do
    # Pods for testing
  end
end

target 'intent-ios' do
  platform :ios, '12.0'
  use_frameworks!
  pod 'MMWormhole'
  pod 'KeychainAccess'
  pod 'SwiftyBeaver'
  pod 'Firebase/RemoteConfig'
  pod 'Firebase/Analytics'
  pod 'Firebase/Crashlytics'
  pod 'CryptoSwift'
  pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.8.0'
end

target 'tunnel-ios' do
  platform :ios, '12.0'
  use_frameworks!
  pod 'MMWormhole'
  pod 'SwiftyBeaver'
  pod 'KeychainAccess'
  pod 'CryptoSwift'
  pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.8.0'
end

target 'tunnel-mac' do
  platform :macos, '10.15'
  use_frameworks!
  pod 'MMWormhole'
  pod 'SwiftyBeaver'
  pod 'KeychainAccess'
  pod 'CryptoSwift'
  pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.8.0'
end

target 'myProject VPN Proxy' do
  # Comment the next line if you don't want to use dynamic frameworks
  platform :macos, '10.15'
  use_frameworks!
  shared_pods

  # Pods for myProject VPN

  target 'myProject-macTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'myProject-macUITests' do
    # Pods for testing
  end

end

# Configure your macCatalyst dependencies
catalyst_configuration do
    # Uncomment the next line for a verbose output
    verbose!

    ios 'GoogleMobileAdsMediationAdColony' # This dependency will only be available for iOS
    ios 'Google-Mobile-Ads-SDK'
        # macos '<pod_name>' # This dependency will only be available for macOS
end

post_install do |installer|

    installer.configure_catalyst
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
         config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'No'
         config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
  end
end

Environment

Many Thanks

fermoya commented 2 years ago

Hi @houmie , where are you getting the error you describe?

ld: framework not found AdColony

I'm assuming you're importing AdColony and the compiler gives you a shout at that line. Are you using some kind of compiler test before importing the dependency as mentioned in this section?

#if canImport(AdColony)
import AdColony
#endif

Does the compiler complain on macOS or iOS?

houmie commented 2 years ago

Hi @fermoya

Thank you for coming back to me.

I get the error when compiling the project.

I'm using AdColony as mediation with Google Admob. I just did a search in the code and I'm nowhere importing AdColony directly. It's rather installed as dependency of GoogleMobileAdsMediationAdColony, which is already excluded. But I think your script may not exclude the dependencies of that Pod above, could that be the case?

But I exclude GoogleMobileAds like this:

#if iOS
import GoogleMobileAds
#endif

class MainViewController: UIViewController, UITextFieldDelegate, UIAlertViewDelegate {
#if iOS
    var rewardedAd: GADRewardedAd?
#endif

Please see compiler error below:

Ld /Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/myProject.app/Contents/MacOS/myProject normal (in target 'myProject' from project 'myProject')
    cd /Users/houmie/Projects/myProject/apple
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios13.1-macabi -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -L/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/usr/lib -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/swift -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/usr/lib -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/maccatalyst -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/PackageFrameworks -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/PackageFrameworks -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/PackageFrameworks -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/CryptoSwift-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/FirebaseABTesting-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/FirebaseCore-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/FirebaseCoreDiagnostics-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/FirebaseCrashlytics-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/FirebaseInstallations-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/FirebaseRemoteConfig-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/GoogleDataTransport-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/GoogleUtilities-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/IQKeyboardManagerSwift -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/KeychainAccess-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/Keys-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/MMWormhole-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/OpenVPNAdapter-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/PromisesObjC-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/SSZipArchive-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/SwiftyBeaver-iOS -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/lottie-ios -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/nanopb-iOS -F/Users/houmie/Projects/myProject/apple/Pods/FBAEMKit/XCFrameworks -F/Users/houmie/Projects/myProject/apple/Pods/FBSDKCoreKit/XCFrameworks -F/Users/houmie/Projects/myProject/apple/Pods/FBSDKCoreKit_Basics/XCFrameworks -F/Users/houmie/Projects/myProject/apple/Pods/FBSDKShareKit/XCFrameworks -F/Users/houmie/Projects/myProject/apple/Pods/FirebaseAnalytics/Frameworks -F/Users/houmie/Projects/myProject/apple/Pods/GoogleAppMeasurement/Frameworks -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/XCFrameworkIntermediates/FBAEMKit -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/XCFrameworkIntermediates/FBSDKCoreKit -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/XCFrameworkIntermediates/FBSDKCoreKit_Basics -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/XCFrameworkIntermediates/FBSDKShareKit -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/XCFrameworkIntermediates/FirebaseAnalytics/AdIdSupport -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/XCFrameworkIntermediates/GoogleAppMeasurement/AdIdSupport -F/Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/XCFrameworkIntermediates/GoogleAppMeasurement/WithoutAdIdSupport -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/System/Library/Frameworks -iframework /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/iOSSupport/System/Library/Frameworks -filelist /Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Intermediates.noindex/myProject.build/Debug-maccatalyst/myProject.build/Objects-normal/arm64/myProject.LinkFileList -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @loader_path/../Frameworks -Xlinker -rpath -Xlinker /usr/lib/swift -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -object_path_lto -Xlinker /Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Intermediates.noindex/myProject.build/Debug-maccatalyst/myProject.build/Objects-normal/arm64/myProject_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/System/iOSSupport/usr/lib/swift -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Intermediates.noindex/myProject.build/Debug-maccatalyst/myProject.build/Objects-normal/arm64/myProject.swiftmodule -ObjC -ObjC -lc++ -liconv -lsqlite3 -lz -framework CoreGraphics -framework CoreTelephony -framework CryptoSwift -framework FBAEMKit -framework FBLPromises -framework FBSDKCoreKit -framework FBSDKCoreKit_Basics -framework FBSDKShareKit -framework FirebaseABTesting -framework FirebaseAnalytics -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseCrashlytics -framework FirebaseInstallations -framework FirebaseRemoteConfig -framework Foundation -framework GoogleAppMeasurement -framework GoogleAppMeasurementIdentitySupport -framework GoogleDataTransport -framework GoogleUtilities -framework IQKeyboardManagerSwift -framework KeychainAccess -framework Keys -framework Lottie -framework MMWormhole -framework NetworkExtension -framework OpenVPNAdapter -framework QuartzCore -framework SSZipArchive -framework Security -framework StoreKit -framework SwiftyBeaver -framework SystemConfiguration -framework UIKit -framework WatchConnectivity -framework nanopb -ObjC -lc++ -liconv -lsqlite3 -lstdc++ -lz -framework AVFoundation -framework AdColony -framework AdColonyAdapter -framework AdSupport -framework AudioToolbox -framework CFNetwork -framework CoreGraphics -framework CoreLocation -framework CoreMedia -framework CoreServices -framework CoreTelephony -framework CoreVideo -framework FBLPromises -framework FBSDKCoreKit -framework FBSDKShareKit -framework FirebaseAnalytics -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseCrashlytics -framework FirebaseInstallations -framework Foundation -framework GoogleAppMeasurement -framework GoogleDataTransport -framework GoogleMobileAds -framework GoogleUtilities -framework IQKeyboardManagerSwift -framework JavaScriptCore -framework KeychainAccess -framework MediaPlayer -framework MessageUI -framework MobileCoreServices -framework NetworkExtension -framework OpenVPNAdapter -framework QuartzCore -framework SSZipArchive -framework Security -framework StoreKit -framework SwiftyBeaver -framework SystemConfiguration -framework UIKit -framework UserMessagingPlatform -framework WebKit -framework nanopb -weak_framework Accelerate -weak_framework Accounts -weak_framework AdSupport -weak_framework AppTrackingTransparency -weak_framework AudioToolbox -weak_framework CoreGraphics -weak_framework Foundation -weak_framework JavaScriptCore -weak_framework QuartzCore -weak_framework SafariServices -weak_framework Security -weak_framework Social -weak_framework StoreKit -weak_framework UIKit -weak_framework WatchConnectivity -weak_framework WebKit -ObjC -ObjC -lc++ -liconv -lsqlite3 -lz -framework CoreGraphics -framework CoreTelephony -framework CryptoSwift -framework FBAEMKit -framework FBLPromises -framework FBSDKCoreKit -framework FBSDKCoreKit_Basics -framework FBSDKShareKit -framework FirebaseABTesting -framework FirebaseAnalytics -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseCrashlytics -framework FirebaseInstallations -framework FirebaseRemoteConfig -framework Foundation -framework GoogleAppMeasurement -framework GoogleAppMeasurementIdentitySupport -framework GoogleDataTransport -framework GoogleUtilities -framework IQKeyboardManagerSwift -framework KeychainAccess -framework Keys -framework Lottie -framework MMWormhole -framework NetworkExtension -framework OpenVPNAdapter -framework QuartzCore -framework SSZipArchive -framework Security -framework StoreKit -framework SwiftyBeaver -framework SystemConfiguration -framework UIKit -framework WatchConnectivity -framework nanopb -lwg-go -framework StoreKit -framework NetworkExtension -framework Pods_myProject -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Intermediates.noindex/myProject.build/Debug-maccatalyst/myProject.build/Objects-normal/arm64/myProject_dependency_info.dat -o /Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Products/Debug-maccatalyst/myProject.app/Contents/MacOS/myProject -Xlinker -add_ast_path -Xlinker /Users/houmie/Library/Developer/Xcode/DerivedData/myProject-ewigkyiwmukfdibbvzefbzcdfqhi/Build/Intermediates.noindex/WireGuardKit.build/Debug-maccatalyst/WireGuardKit.build/Objects-normal/arm64/WireGuardKit.swiftmodule

ld: framework not found AdColony
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is so strange..what could it be?

fermoya commented 2 years ago

@houmie the error displays Debug-maccatalyst, that means you're compiling for macOS and yet, #if iOS resolves true and tries to import the framework.

macCatalyst used iOS SDK under the hood so that condition resolves to true. The error should be resolved if you change:

#if iOS
import GoogleMobileAds
#endif

To

#if canImport(GoogleMobileAds)
import GoogleMobileAds
#endif

Or

#if !targetEnvironment(macCatalyst) 
import GoogleMobileAds
#endif

Please give it a try.

houmie commented 2 years ago

@fermoya Thanks Fernando.

I just tried that replaced all of #if iOS with #if !targetEnvironment(macCatalyst). But sadly I get the exact same error when building the project. I cleaned the build folder and even ran pod catalyst run again. But same issue :-(

fermoya commented 2 years ago

@houmie I've prepared a branch where I've added the problematic dependencies to my Sample project, you can find it here: https://github.com/fermoya/cocoapods-catalyst-support/tree/fix/issue-36/Sample

Can you please download that code and let me know if it compiles? I can make it compile. Check out how I import the framework: https://github.com/fermoya/cocoapods-catalyst-support/blob/fix/issue-36/Sample/Sample/ViewController.swift

Both iOS and macCatalyst compile. The former crashes as I'm not initializing Google Mobile Ads SDK whereas the latter compiles, runs and prints Not imported.

I'm seeing no issue with those two pods (GoogleMobileAdsMediationAdColony and Google-Mobile-Ads-SDK)

houmie commented 2 years ago

Hello @fermoya

Thank you for the branch provided. I have tried your project and can confirm that it works. I still don't know what is causing the issue in my project. You have seen the output earlier yourself. I think the target might be a bit old as I have it for a few years and maybe some setting in it is not up-to-date.

Even though if I'd bypass that the next issue with Wireguard came down to hit me. So I'm pretty much about to give up on Catalyst altogether before even reaching a consensus what actually went wrong here. Thanks again.

Brett-Best commented 2 years ago

@houmie might be worth trying [bundle exec] pod deintegrate then [bundle exec] pod install remove the [bundle exec] from the commands if you aren’t using a Gemfile. If you haven’t already, deleting derived data manually might help rm -rf ~/Library/Developer/Xcode/DerivedData.