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

Shared Not Concurrency Safe #74

Open
emadhegab opened this issue Aug 21, 2024 · 5 comments
Open

Shared Not Concurrency Safe #74

emadhegab opened this issue Aug 21, 2024 · 5 comments

Comments

@emadhegab
Copy link

Hello, We have latest exponea sdk 2.28.0, we get the warning
Reference to class property 'shared' is not concurrency-safe because it involves shared mutable state; this is an error in the Swift 6 language mode

Screenshot 2024-08-21 at 14 45 54

Screenshot 2024-08-21 at 14 46 15

is there a better way than singleton to init the exponea in the newest versions?

@Ankmara
Copy link
Collaborator

Ankmara commented Aug 22, 2024

Hi, thank you for report. We don't support beta versions (Swift 6). When the version of Swift is officially released, we will definitely cover it. You can use ExponeaInternal() as a public property instead of shared, but we can't guarantee functionality.

@Ankmara Ankmara closed this as completed Aug 22, 2024
@emadhegab
Copy link
Author

As swift 6 officially released. we can't work anymore with the sdk

@Ankmara
Copy link
Collaborator

Ankmara commented Sep 18, 2024

Hi, I am trying to simulate this warning, but no luck. How this warning blocked you? Could you share your implementation for ExponeaServicing please?

@xcibik00 xcibik00 reopened this Sep 18, 2024
@emadhegab
Copy link
Author

emadhegab commented Sep 18, 2024

sure.. here is how the error now looks when we start using swift 6 in our project. you need to make your SPM or the main bundle uses swift 6
Screenshot 2024-09-18 at 13 40 55

and here is the code directly so you can see it yourself

`

class ExponeaService: ExponeaServicing {
    func setup(withTrackingConsent: Bool) {
        Exponea.shared.configure(
            Exponea.ProjectSettings(
                projectToken: "<PROJECT_ID",
                authorization: .token("<TOKEN>"),
                baseUrl: "https://api.eu1.exponea.com"
            ),
            pushNotificationTracking:
                withTrackingConsent ? .enabled(appGroup: AppConfigurations.Environment.appGroupBundleID) : .disabled
        )
    }

    func anonymizeUser() {
        Exponea.shared.anonymize()
    }

    func sendUserID(_ id: String) {

        let properties: [String: String] = [
            "customer_id": id
        ]

        Exponea.shared.identifyCustomer(customerIds: properties,
                                        properties: [:], timestamp: nil)
    }

    func registerToken(_ token: Data) {
        guard Exponea.shared.isConfigured else { return }
        Exponea.shared.trackPushToken(token)
    }
}

`

@Ankmara
Copy link
Collaborator

Ankmara commented Sep 19, 2024

Thank you. We started with fixing.

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

3 participants