Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Brian-Co opened this issue May 16, 2023 · 4 comments

Comments

@Brian-Co
Copy link

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!

@bgiori
Copy link
Collaborator

bgiori commented May 17, 2023

Hi @Brian-Co, Thanks for such a detailed report.

I'd like to keep the deployment target as low as possible in order to support as many devices and OS versions as possible. That said I understand that iOS 10 is ~7 years old as of now.

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.

Can you elaborate on the reason around setting the IPHONEOS_DEPLOYMENT_TARGET for each dependency in the post install script?

Thanks.

@Brian-Co
Copy link
Author

Brian-Co commented May 25, 2023

Hi @bgiori,

Thank you for your quick reply. I don't think a fix would require you to change the deployment target. For instance, the Amplitude pod also has a deployment target of iOS 10, and changing it in the main app to iOS 13 or above doesn't cause such a crash. That's why I was wondering that maybe you would know what could cause such an issue for AnalyticsConnector.

Now about the reason around setting the IPHONEOS_DEPLOYMENT_TARGET for each dependency in the post install script, it comes from a user's podfile so we don't know the reason for sure. But I think it is to avoid the Xcode warnings that can show up for some dependencies, such as:

The iOS deployment target 'PHONEOS_DEPLOYMENT_TARGET' is set to 10.0, but the range of supported deployment target versions is 11.0 to 16.4.99.

Hope it helps!

@Brian-Co Brian-Co reopened this May 25, 2023
@bgiori
Copy link
Collaborator

bgiori commented May 25, 2023

I think it works for the Amplitude analytics SDK since it is written purely in Objective-C. The error seems to be swift specific:

dyld[1534]: Symbol not found: __ZN5swift34swift50override_conformsToProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEPFPKNS_18TargetWitnessTableIS1_EES4_S8_E

I'll keep digging around.

@Brian-Co
Copy link
Author

Brian-Co commented Jun 1, 2023

Hello @bgiori,

I found out that the post install script might be needed to fix an Xcode 14.3 issue which prevents compiling some pods dependencies if their deployment target is not set to iOS 13 or higher. See this thread:
https://stackoverflow.com/questions/75574268/missing-file-libarclite-iphoneos-a-xcode-14-3

Hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants