OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.56k stars 368 forks source link

[Bug]: No type or protocol named 'OSUser' and 'OSLiveActivities' #1717

Open WillyRosa opened 1 week ago

WillyRosa commented 1 week ago

What happened?

I have installed latest version and after compiling the app. I'm getting this issue.

Screenshot 2024-06-18 at 16 35 32

Steps to reproduce?

1. Install latest sdk
2. Pod install
3. Run the app
4. Got those issues

What did you expect to happen?

I expect the app to compile and run on my emulator.

React Native OneSignal SDK version

5.2.0

Which platform(s) are affected?

Relevant log output

No response

Code of Conduct

SagredoIsmael commented 1 week ago

Same to me 🙏🏻

oumaima-khameri commented 1 week ago

Moi aussi

kelbin commented 1 week ago

I found a solution, you need to downgrade your version of library to 5.1.6 (before they announced live activities). It works for me, but anyway that's the temporary solution.

KodyKendall commented 6 days ago

@kelbin how did you do this? What does your Podfile look like?

KodyKendall commented 6 days ago

Thanks, @kelbin, I was able to get this workaround working by running rm -rf node_modules, then changing my package.json to be "react-native-onesignal": "~5.1.6", then running yarn install, and resolving to 5.1.3, so my yarn.lock file looked like this:

react-native-onesignal@~5.1.6:
  version "5.1.3"
  resolved "https://registry.yarnpkg.com/react-native-onesignal/-/react-native-onesignal-5.1.3.tgz#2da1819255a329dca6571ddef22184410c26b627"
  integrity sha512-ynHUqN6TaV98xghA05GddwBXF41jgb7BboP2xucvvJljxEw6CICnaiMfcupsxGNNHm74FBLsl5JK3qMuoLpoJw==
  dependencies:
    invariant "^2.2.2"

Then, I ran: cd ios && rm -rf Pods && rm Podfile.lock, and then modified Podfile to be:

...
pod 'OneSignalXCFramework', '5.1.6'
...

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignalXCFramework', '5.1.6'
end

That got it to build on iOS.

Chasty commented 3 days ago

@nan-li can u check this issue, it is happening to a lot of users.

Chasty commented 3 days ago

Thanks, @kelbin, I was able to get this workaround working by running rm -rf node_modules, then changing my package.json to be "react-native-onesignal": "~5.1.6", then running yarn install, and resolving to 5.1.3, so my yarn.lock file looked like this:

react-native-onesignal@~5.1.6:
  version "5.1.3"
  resolved "https://registry.yarnpkg.com/react-native-onesignal/-/react-native-onesignal-5.1.3.tgz#2da1819255a329dca6571ddef22184410c26b627"
  integrity sha512-ynHUqN6TaV98xghA05GddwBXF41jgb7BboP2xucvvJljxEw6CICnaiMfcupsxGNNHm74FBLsl5JK3qMuoLpoJw==
  dependencies:
    invariant "^2.2.2"

Then, I ran: cd ios && rm -rf Pods && rm Podfile.lock, and then modified Podfile to be:

...
pod 'OneSignalXCFramework', '5.1.6'
...

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignalXCFramework', '5.1.6'
end

That got it to build on iOS.

but they dont have a 5.1.6 version on react-native-onesignal repo.

KodyKendall commented 3 days ago

You're right, it was resolving it to 5.1.3, so I recommend replacing 5.1.6 with 5.1.3. 👍

On Thu, Jun 27, 2024 at 1:33 PM Willy Rosa @.***> wrote:

Thanks, @kelbin https://github.com/kelbin, I was able to get this workaround working by running rm -rf node_modules, then changing my package.json to be "react-native-onesignal": "~5.1.6", then running yarn install, and resolving to 5.1.3, so my yarn.lock file looked like this:

react-native-onesignal@~5.1.6: version "5.1.3" resolved "https://registry.yarnpkg.com/react-native-onesignal/-/react-native-onesignal-5.1.3.tgz#2da1819255a329dca6571ddef22184410c26b627" integrity sha512-ynHUqN6TaV98xghA05GddwBXF41jgb7BboP2xucvvJljxEw6CICnaiMfcupsxGNNHm74FBLsl5JK3qMuoLpoJw== dependencies: invariant "^2.2.2"

Then, I ran: cd ios && rm -rf Pods && rm Podfile.lock, and then modified Podfile to be:

... pod 'OneSignalXCFramework', '5.1.6' ...

target 'OneSignalNotificationServiceExtension' do pod 'OneSignalXCFramework', '5.1.6' end

That got it to build on iOS.

but they dont have a 5.1.6 version on react-native-onesignal repo.

— Reply to this email directly, view it on GitHub https://github.com/OneSignal/react-native-onesignal/issues/1717#issuecomment-2195620618, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRUYVGBPPRN2FF2QA7OSWLZJRZH5AVCNFSM6AAAAABJQ2WEJKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJVGYZDANRRHA . You are receiving this because you commented.Message ID: @.***>

-- Kody K. Founder, Field Rocket 801-349-9925 Building The World's Easiest Software for Residential Contractors https://fieldrocket.us https://fieldrocket.us/

kelbin commented 3 days ago

I used a unity build (the error same for all platform, except iOS), 5.1.6 exist there.