问题描述
在我的应用中,我有一些推送通知订阅者(OneSignal).我正在尝试获得这样的用户ID:
In my app, I have some push notification subscribers (OneSignal). I am trying to get the user id's like this:
OneSignal.GetIdsAvailable(IdsAvailable);
....
....
private void IdsAvailable(string userID, string pushToken)
{
playeridx = userID;
System.Diagnostics.Debug.WriteLine("UserID:" + userID);
System.Diagnostics.Debug.WriteLine("pushToken:" + pushToken);
}
但是我收到一个错误:"OneSignal不包含GetIdsAvailable的定义."
But I get an error: "OneSignal does not contain a definition for GetIdsAvailable."
有什么想法吗?
推荐答案
您似乎正在使用 OneSignal Windows SDK .如果要在Unity中执行此操作,请设置Unity SDK(如果尚未这样做),然后使用 GetPermissionSubscriptionState 可以检索当前用户的userId
和pushToken
,而不是使用.GetIdsAvailable()
.
It looks like you are using a method found in the OneSignal Windows SDK. If you want to do this in Unity, setup the Unity SDK (if you haven't done so already) and then perhaps use GetPermissionSubscriptionState to retrieve the userId
and pushToken
of the current user, instead of using .GetIdsAvailable()
.
这篇关于使用Unity(C#)获取OneSignal用户ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!