OneSignal / OneSignal-Xamarin-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com
Other
104 stars 50 forks source link

No support to get UserId/PlayerId #308

Open douglassimaodev opened 2 years ago

douglassimaodev commented 2 years ago

I am using the new OneSignalSDK.Xamarin 4.1.0

I cant find it in the documentation, how can I get the userId/PlayerId as we could get in the old version?

I am uxing xamarin forms 5.0.0.2478

OneSignal.Current.IdsAvailable(new Com.OneSignal.Abstractions.IdsAvailableCallback((playerID, pushToken) =>
{
    playerId = playerID;
}));
jkasten2 commented 2 years ago

@douglassimaodev Thanks for your question. This IdsAvailable has been changed to OneSignal.Default.PushSubscriptionState.userId. See the full API change list below: https://documentation.onesignal.com/docs/xamarin-40-api-reference#push-notifications

douglassimaodev commented 2 years ago

Thanks, that really helps!

I just created an default xamarin forms app and I cant even build it, anything in particular I need to do in order to get it working in the ios app?

Severity Code Description Project File Line Suppression State Error Could not copy "C:...\packages\onesignalsdk.xamarin\4.1.0\build\Xamarin.iOS....\content\OneSignalSDK.Xamarin.iOS.resources\OneSignalExtension.xcframework\ios-arm64_x86_64-maccatalyst\OneSignalExtension.framework\Versions\A\Headers\OneSignalNotificationServiceExtensionHandler.h" to "C:...\source\repos\DemoApp\DemoApp\DemoApp.iOS\bin\iPhone\Debug\/OneSignalSDK.Xamarin.iOS.resources/OneSignalExtension.xcframework\ios-arm64_x86_64-maccatalyst\OneSignalExtension.framework\Versions\A\Headers\OneSignalNotificationServiceExtensionHandler.h". Exceeded retry count of 10. Failed. DemoApp.iOS

Would you have by any change a demo app in xamarin forms to show how to properly implement it?

jkasten2 commented 2 years ago

@douglassimaodev Thanks for reporting the iOS build error with the OneSignal 4.1.0 SDK. Do you also see this on the OneSignal 4.0.0 version?

douglassimaodev commented 2 years ago

I tried and I am getting:

Severity Code Description Project File Line Suppression State Error Failed to codesign 'bin/iPhone/Debug/device-builds/iphone8.1-15.5/OneSignalNotificationServiceExtension.appex///.metallib': /Users//Library/Caches/Xamarin/mtbs/builds/OneSignalNotificationServiceExtension/f79c2708a21acc1a36e28.**/bin/iPhone/Debug/device-builds/iphone8.1-15.5/OneSignalNotificationServiceExtension.appex///*.metallib: No such file or directory OneSignalNotificationServiceExtension

Severity Code Description Project File Line Suppression State Error Failed to codesign 'bin/iPhone/Debug/device-builds/iphone8.1-15.5/OneSignalNotificationServiceExtension.appex///.dylib': /Users//Library/Caches/Xamarin/mtbs/builds/OneSignalNotificationServiceExtension/f79c2708a21ac/bin/iPhone/Debug/device-builds/iphone8.1-15.5/OneSignalNotificationServiceExtension.appex///.dylib: No such file or directory OneSignalNotificationServiceExtension

Severity Code Description Project File Line Suppression State Error /usr/bin/codesign exited with code 1 OneSignalNotificationServiceExtension

Xamarin forms 5.0.0.2012

tanaynigam commented 1 year ago

@douglassimaodev Could you provide us with details regarding which Operating system and Visual Studio version are you using to build the OneSignalSDK.Xamarin version 4.1.0. Also whether you are facing this issue when building on a simulator or a device

ChoyWingLun commented 1 year ago

@douglassimaodev Thanks for your question. This IdsAvailable has been changed to OneSignal.Default.PushSubscriptionState.userId. See the full API change list below: https://documentation.onesignal.com/docs/xamarin-40-api-reference#push-notifications

Hi I have some scenario where OneSignal.Default.PushSubscriptionState.userId returning null, maybe I know why?