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

Replace sdkInfo on iOS #1056

Closed
marandaneto opened this issue Oct 10, 2022 · 5 comments · Fixed by #1060
Closed

Replace sdkInfo on iOS #1056

marandaneto opened this issue Oct 10, 2022 · 5 comments · Fixed by #1060

Comments

@marandaneto
Copy link
Contributor

marandaneto commented Oct 10, 2022

Description

if let sdkInfo = self.sentryOptions?.sdkInfo {
infos["package"] = ["version": sdkInfo.version, "sdk_name": "cocoapods:sentry-cocoa"]
}

sdkInfo is deprecated getsentry/sentry-cocoa#1960

The current alternative is the Private class but I can't add a new package https://github.com/getsentry/sentry-cocoa/blob/be47c6c37e25c3c5d92cceb875c6f408f76017f8/Sources/Sentry/PrivateSentrySDKOnly.m#L80-L99

This leads to warns during build #1055

Similar to getsentry/sentry-react-native#2530

@marandaneto
Copy link
Contributor Author

@brustolin @philipphofmann is there any other way of adding packages now?

@brustolin
Copy link
Collaborator

instead of this:

if let sdkInfo = self.sentryOptions?.sdkInfo { 
    infos["package"] = ["version": sdkInfo.version, "sdk_name": "cocoapods:sentry-cocoa"] 
} 

Do this

infos["package"] = ["version": PrivateSentrySDKOnly.getSdkVersionString(), "sdk_name": "cocoapods:sentry-cocoa"]

@marandaneto
Copy link
Contributor Author

@brustolin I don't follow, where does infos come from?

@brustolin
Copy link
Collaborator

infos is a SentryFlutterPluginApple.swift local dictionary.

@marandaneto
Copy link
Contributor Author

Oh yeah that makes sense, my bad.
Since Dart also adds the new package in the Dart layer

final packageMap = infos['package'] as Map?;
if (packageMap != null && packageMap.isNotEmpty) {
final package = Map<String, String>.from(packageMap);
final sdk = event.sdk ?? _options.sdk;
final name = package['sdk_name'];
final version = package['version'];
if (name != null &&
version != null &&
!sdk.packages.any((element) =>
element.name == name && element.version == version)) {
sdk.addPackage(name, version);

This works for now.

@marandaneto marandaneto moved this from Blocked to Needs Discussion in Mobile & Cross Platform SDK Oct 10, 2022
Repository owner moved this from Needs Discussion to Done in Mobile & Cross Platform SDK Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants