amplitude / amplitude/analytics-connector-ios

App crashes at launch when AnalyticsConnector's iOS Deployment Target is different between an app and an embed Framework

未关闭
#2 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Swift
星标
6
派生
15
平均合并
1 天 8 小时
30 天内合并 PR
3

描述

Hello,

We are developing a Framework which uses `Amplitude iOS SDK`, which depends on `AnalyticsConnector` starting with `Amplitude 8.8`.
The Framework is compiled with dependency set to `pod 'Amplitude', '~> 8.10.0'` in the podfile. It links pods dynamically through the `use_frameworks!` statement. Our Framework's podspec states dependency toward `'Amplitude', '~> 8.8'`. Therefore, when our Framework gets installed in an app, Amplitude and AnalyticsConnector both get installed in the main app.

When installing the Framework in an app, if we change the AnalyticsConnector's iOS Deployment Target in the main app to iOS 13.0 or above, the app crashes at launch with the message below:

```
dyld[1534]: Symbol not found: __ZN5swift34swift50override_conformsToProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEPFPKNS_18TargetWitnessTableIS1_EES4_S8_E
Referenced from: [...] /Framework
Expected in: [...] MainApp.app/Frameworks/AnalyticsConnector.framework/AnalyticsConnector
```

This happens as the main app changes all pods' iOS Deployment Targets to be the same as the main app (in our case, iOS 14.0) through a `post_install` script in the podfile. The Framework, on the other hand, was compiled with AnalyticsConnector default iOS Deployment Target, which is iOS 10.0.

To avoid the crash, the workaround has been to create an exception for AnalyticsConnector like this:

```
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if target.name != "AnalyticsConnector"
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = platformVersion
end
end
end
end

```

In our case, the main app integrates over 30 dependencies, and none of them produces the same kind of bug.

Do you know what is causing the problem? And if yes, do you know if it will be fixed?

Thank you!

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。