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' is inaccessible due to 'internal' protection level #345

Closed
Ravinder-webonise opened this issue May 15, 2024 · 5 comments · Fixed by #347
Closed

'shared' is inaccessible due to 'internal' protection level #345

Ravinder-webonise opened this issue May 15, 2024 · 5 comments · Fixed by #347
Assignees
Labels

Comments

@Ravinder-webonise
Copy link

Hey Team i am facing one issue related to Segment SDK.
i have installed Segment SDK using Package Dependancy. Everything working fine.
When i am trying to Track the Event , it showing me error ie :-
'shared' is inaccessible due to 'internal' protection level.
I know how to fix it, but for that i have to edit the framework file , but due tocode security i am not able to edit the Anylytics.swift File . can you please help me here.
Thanks.
For your Reference i have attached the error screenshot.

Screenshot 2024-05-15 at 1 29 36 PM
@bsneed
Copy link
Contributor

bsneed commented May 15, 2024

Nice find, I had no idea that wasn't public, thank you! That method is mostly intended for migration from analytics-ios though. A better path forward would be something like this ...

/**
 An example of implementing multiple Analytics instances in a single application.
 */
extension Analytics {
    static var main = Analytics(configuration: Configuration(writeKey: "1234")
                                    .flushAt(3)
                                    .trackApplicationLifecycleEvents(true))
    
    static var support = Analytics(configuration: Configuration(writeKey: "5678")
                                    .flushAt(10)
                                    .trackApplicationLifecycleEvents(false))
}

@Ravinder-webonise
Copy link
Author

Ravinder-webonise commented May 15, 2024

Hi @bsneed Thanks for your quick reply. I saw that you have updated the Analytics File and merged with Main Branch. But i have updated my Package many times and also re installed the package but can't see your new changes. i am still getting older code. can you please reverify it once.
Note:- I saw the release of the code which is showing 3 week Ago. Please release the new version of Package Dependancy so that i can use your latest code
For your reference attaching screenshot...
Screenshot 2024-05-15 at 9 03 34 PM

@bsneed
Copy link
Contributor

bsneed commented May 15, 2024

@Ravinder-webonise we have other changes in flight. It won't be in a release until those are complete. As I mentioned, it's best to use the method I referenced above, not shared().

@Ravinder-webonise
Copy link
Author

Hi @bsneed yeah i have tried with above alternate which you have mentioned , but it doesn't work for me. I can't use Multiple Analytics instance's with the same Key.
Its throwing the error's.
Note:- why we use multiple keys in a single project ? i tried with multiple instances using single Key , and i got the fatal error , you can't use single key with multiple instances.

Attaching screenshot of it..
Screenshot 2024-05-15 at 9 38 44 PM

@bsneed
Copy link
Contributor

bsneed commented May 15, 2024

You can't have multiple instances with the same key. They need to be different write keys. That behavior is intentional.

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

Successfully merging a pull request may close this issue.

2 participants