JivoChat / JivoSDK-iOS

The Jivo Mobile SDK allows you to embed the Jivo chat into your iOS mobile applications to receive customer requests
https://www.jivochat.com
Apache License 2.0
8 stars 5 forks source link

Symbol not found #2

Open ChristianMoler opened 2 years ago

ChristianMoler commented 2 years ago

На последней версии и ранних получаю краш на запуске.

dyld[2904]: Symbol not found: ZN5swift34swift50override_conformsToProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEPFPKNS_18TargetWitnessTableIS1_EES4_S8_E Referenced from: /private/var/containers/Bundle/Application/B5062C0E-E262-4A4C-ADB5-EFBD34C1767C/__/Frameworks/JivoSDK.framework/JivoSDK Expected in: /private/var/containers/Bundle/Application/B5062C0E-E262-4A4C-ADB5-EFBD34C1767C/__/Frameworks/CollectionAndTableViewCompatible.framework/CollectionAndTableViewCompatible Symbol not found: __ZN5swift34swift50override_conformsToProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEPFPKNS_18TargetWitnessTableIS1_EES4_S8_E Referenced from: /private/var/containers/Bundle/Application/B5062C0E-E262-4A4C-ADB5-EFBD34C1767C/____/Frameworks/JivoSDK.framework/JivoSDK Expected in: /private/var/containers/Bundle/Application/B5062C0E-E262-4A4C-ADB5-EFBD34C1767C/__/Frameworks/CollectionAndTableViewCompatible.framework/CollectionAndTableViewCompatible (lldb)

На версии 1.7 было нормально

bronenos commented 2 years ago

Под какую архитектуру возникает такая проблема?

4tune commented 1 year ago

Та же ошибка. Собираем под iPhone. Версия 2.1.3

ChristianMoler commented 1 year ago

Ошибка сохраняется

AndrewNes commented 1 year ago

Идентичная проблема:

bronenos commented 1 year ago

Оказалось затруднительно диагностировать проблему, учитывая что она проявляется не у всех. Но самая первая рекомендация: удостовериться, что у всех зависимостей проекта проставлен флаг BUILD_LIBRARY_FOR_DISTRIBUTION=YES.

AbdulahadTursunov commented 1 year ago

проблема до сих пор есть xcode 14.2 v3.0.0

флаг BUILD_LIBRARY_FOR_DISTRIBUTION = true включен

AndrewNes commented 1 year ago

У меня данная проблема, проявляется именно в React-Native проектах. И добавление одного флага BUILD_LIBRARY_FOR_DISTRIBUTION = true для меня оказалось недостаточно. Но у меня сработало данное решение в Podfile:

def getBuildLibrariesForDistribution(installer)
     juvoLibName = [
      "BABFrameObservingInputAccessoryView", "CollectionAndTableViewCompatible", "DTCollectionViewManager",
      "DTModelStorage", "GzipSwift", "JFEmojiPicker", "JFMarkdownKit", "JFWebSocket", "JMCodingKit",
      "JMDesignKit", "JMImageLoader", "JMMarkdownKit", "JMOnetimeCalculator", "JMRepicKit", "JMScalableView",
      "JMShared", "JMSidePanelKit", "JMTimelineKit", "KeychainSwift", "ObjcExceptionBridging", "PureParser",
      "ReachabilitySwift", "Realm", "RealmSwift", "SafeURL", "SwiftGraylog", "SwiftMime", "SwiftyNSException",
      "TypedTextAttributes", "XCGLogger", "SwiftDate", "libPhoneNumber-iOS"
     ]
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
         if (juvoLibName.include? target.to_s)
             config.build_settings['GENERATE_INFOPLIST_FILE'] = 'YES'
            config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
          end
        end
    end
  end

Где функция getBuildLibrariesForDistribution(installer) добавлена в тело post_install do |installer|

Да, решение не из самых лучших, но у меня работает.

bronenos commented 1 year ago

На основании решения @AndrewNes сформировали вариант ниже. Попробуйте, пожалуйста.

Про настройки IPHONEOS_DEPLOYMENT_TARGET и GENERATE_INFOPLIST_FILE пока еще не удалось понять однозначно, как они должны выглядеть (или же каждому проекту индивидуальный подход), и потому возможно с ними еще доведётся поиграться.

Но вместо указания кучи библиотек, вот этот скрипт должен сам сканировать и находить нужные. А мы тем временем работаем над вариантом Open Source вместо раздачи в виде framework, поэтому такие проблемы в последствии должны попросту исчезнуть.

post_install do |installer|
  JivoPatcher.new(installer).patch()
end

class JivoPatcher
  def initialize(installer)
    @sdkname = "JivoSDK"
    @installer = installer
  end

  def patch()
    libnames = collectLibNames()

    @installer.pods_project.targets.each do |target|
      if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
        target.build_configurations.each do |config|
          config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
        end
      end

      target.build_configurations.each do |config|
        if libnames.include? target.to_s
          config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
          config.build_settings['GENERATE_INFOPLIST_FILE'] = 'YES'
        end
      end
    end
  end

  private def collectLibNames()
    depnames = Array.new

    @installer.pod_targets.each do |target|
      next if target.to_s != @sdkname
      depnames = collectTargetLibNames(target)
    end

    return depnames.uniq()
  end

  private def collectTargetLibNames(target)
    depnames = [target.to_s]

    target.dependent_targets.each do |subtarget|
      depnames += [subtarget.to_s] + collectTargetLibNames(subtarget)
    end

    return depnames
  end
end
AndrewNes commented 5 months ago

В xCode 15, возможно придется брать строчку "config.build_settings['GENERATE_INFOPLIST_FILE'] = 'YES'"