OneSignal/OneSignal-Xamarin-SDK

No support to get UserId/PlayerId

douglassimaodev opened this issue · 6 comments

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;
}));

@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

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?

@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?

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

@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

@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?