fermoya/cocoapods-catalyst-support

Not working for AppCenter pods

Closed this issue · 5 comments

Dids commented

The script seems to pick up the AppCenter pod just fine, but when building for macOS/Catalyst, it's still trying to include AppCenter.

The AppCenter target doesn't seem to be a shared library either and it's an aggregate target instead, in case this makes a difference.

Linker error:

ld: in /Users/dids/MyApp/Pods/AppCenter/AppCenter-SDK-Apple/iOS/AppCenter.framework/AppCenter(MSAppCenter.o), building for Mac Catalyst, but linking in object file built for iOS Simulator, file '/Users/dids/MyApp/Pods/AppCenter/AppCenter-SDK-Apple/iOS/AppCenter.framework/AppCenter' for architecture x86_64

Podfile:

load 'remove_ios_only_frameworks.rb'

platform :ios, '13.0'

target 'MyApp' do
  use_frameworks!

  pod 'AppCenter'
  pod 'AppCenter/Distribute'
end

def catalyst_unsupported_pods
  [
    "AppCenter", "AppCenter/Distribute"
  ]
end

post_install do |installer|   
  installer.configure_support_catalyst
end

A bit unrelated, but I believe AppCenter is now also available through the Swift Package Manager, but I'm assuming this wouldn't solve my issues and would just make them worse, having even less control over them?

Dids commented

Never mind! Not only was this due to the main application project having AppCenter "statically" defined under Other Linker Flags, the Swift Package Manager version of AppCenter seems to support both iOS and macOS, so all is well.

Someone asked me the same question in my original gist (see last comments).

When you do pod AppCenter/Distribute it seems that the pod target installed is called AppCenter and not AppCenterDistribute as the script expects. So instead, you should add AppCenter to the unsupported list. This was my answer:

@Dids where did you see AppCenter was statically defined? This could be helpful for me to update the script. If this is an option in Cocoapods then I could perhaps fix this. Currently the script would swap AppCenter/Distribute with AppCenterDistribute and this was the issue.

@fermoya that was me, sorry I didn’t get around to replying. I ended up following the suggestion, for some reason I think the bundle included was still getting added to the target causing issues. I resolved that by adding macCatalyst dedicated configurations. I was meaning to create a reproducible project for you, which I can do if you’d like?

@Brett-Best no worries, yesterday I included some changes in the script and the issue should be solved, including the AppCenterDistributeResources.bundle issue.

@fermoya just tested using the latest version, works great! Was able to remove my macCatalyst specific configurations as well 🎉. Thanks!