Countly / countly-sdk-ios

Countly Product Analytics iOS SDK with macOS, watchOS and tvOS support.
https://count.ly
MIT License
615 stars 243 forks source link

Can't use PLCrashReporter #319

Closed cherpake closed 2 months ago

cherpake commented 3 months ago

I'm trying to switch to PLCrashReporter but I'm always getting "PLCrashReporter dependency can not be found in Project" exception.

My Podfile looks like this:

target 'Control' do
  use_frameworks!
  pod 'Countly-PL/PL', :git => 'https://github.com/Countly/countly-sdk-ios.git', :branch => "master".
  pod 'PLCrashReporter'
end

I'm sure I'm doing something wrong, but can't figure out what.

cherpake commented 3 months ago

This is solved by manually adding -framework "CrashReporter" to Other linker flags for Countly target in Pods project

cherpake commented 3 months ago

Seems like this hack is working:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name  == "Countly"
          config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)']
          config.build_settings['OTHER_LDFLAGS'] << '-framework "CrashReporter"'
      end
    end
  end
end
cherpake commented 3 months ago

or not :( I'm not sure what's going on anymore...

cherpake commented 3 months ago

OK, seems I need this too

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name  == "Countly"
          config.build_settings['OTHER_LDFLAGS'] ||= ['$(inherited)']
          config.build_settings['OTHER_LDFLAGS'] << '-framework "CrashReporter"'

          config.build_settings['LIBRARY_SEARCH_PATHS'] ||= ['$(inherited)']
          config.build_settings['LIBRARY_SEARCH_PATHS'] << "${PODS_XCFRAMEWORKS_BUILD_DIR}/PLCrashReporter"
          config.build_settings['FRAMEWORK_SEARCH_PATHS'] ||= ['$(inherited)']
          config.build_settings['FRAMEWORK_SEARCH_PATHS'] << "${PODS_XCFRAMEWORKS_BUILD_DIR}/PLCrashReporter"
      end
    end
  end
end
ijunaid commented 2 months ago

Hi @cherpake, Thank you for reporting the issue and providing the solution. We are able to reproduce the issue and with your solution it works fine. We've also updated the SDK documentation accordingly. Apologies for the delayed response.