amplitude / amplitude/analytics-connector-ios

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

Aperta
#2 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Swift
Stelle
6
Fork
15
Merge medio
1g 8h
PR unite (30g)
3

Descrizione

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!

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.