1
我花了一天時間嘗試讓推送通知與iOS應用的Parse Unity SDK一起工作。Unity Parse Push無法在iOS 9.1,Unity 4.6.9和Parse 1.6.1中註冊設備
我跟iOS的推送通知教程:https://parse.com/tutorials/ios-push-notifications
我還用通過解析推送通知提供的快速啓動應用程序:https://parse.com/apps/quickstart#parse_push/unity/ios/new
但還是設備將不會出現。
我已經搜索了這個論壇,但是我找不到答案。
是的,我已閱讀指南中提到的故障排除指南。
當我在手機上運行應用程序時,它確實要求允許推送通知,因此它似乎有點工作。
但解析不會拿起設備,所以我不能發送通知
但與任何測試應用程序我做它不會註冊的應用程序。這裏也是我正在使用的代碼:
using UnityEngine;
using System.Collections.Generic;
using System.Collections;
using Parse;
using System;
public class PushBehaviour : MonoBehaviour {
// Use this for initialization
void Awake() {
#if UNITY_IOS
NotificationServices.RegisterForRemoteNotificationTypes(RemoteNotificationType.Alert |
RemoteNotificationType.Badge |
RemoteNotificationType.Sound);
var installation = ParseInstallation.CurrentInstallation;
installation.Channels = new List<string> { "ParseTest" };
installation.SaveAsync();
#endif
ParsePush.ParsePushNotificationReceived += (sender, args) => {
#if UNITY_ANDROID
AndroidJavaClass parseUnityHelper = new AndroidJavaClass("com.parse.ParsePushUnityHelper");
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
// Call default behavior.
parseUnityHelper.CallStatic("handleParsePushNotificationReceived", currentActivity, args.StringPayload);
#elif UNITY_IOS
IDictionary<string, object> payload = args.Payload;
foreach (var key in payload.Keys) {
Debug.Log("Payload: " + key + ": " + payload[key]);
}
#endif
};
}
}
任何有關我哪裏出錯的反饋將受到高度讚賞。
謝謝你的時間。
這是什麼版本? Unity 5?我使用的是Unity 4.6,它沒有UnityEngine.iOS – user1874900