コード例 #1
0
        public PushModel PushNotification(PushModel model)
        {
            try
            {
                Boolean bsandbox = true;

                string p12fileName = Server.MapPath("~/Upload/Prosoft/iOS/ck_dev.pem");
                string p12password = "******";

                string deviceID1 = "ee98207ba890fe56bc6402991d03334f199688fbef943a9da7a33a0565c740d0"; //

                string alert       = model.message + " at " + DateTime.Now.ToLongTimeString();
                string soundstring = "default";
                var    payload1    = new NotificationPayload(deviceID1, alert, model.badge, soundstring);


                var notificationList = new List <NotificationPayload> {
                    payload1
                };
                var push     = new PushNotification(bsandbox, p12fileName, p12password);
                var rejected = push.SendToApple(notificationList);
                model.IsResult = true;
            }
            catch (Exception ex)
            {
                model.MsgError.Add(ex);
                model.IsResult = true;
            }
            return(model);
        }
コード例 #2
0
        public PushModel TestPushPro(PushModel model)
        {
            try
            {
                Boolean bsandbox    = false;
                string  p12fileName = Server.MapPath("~/Upload/Prosoft/iOS/ck_pro.pem");

                string deviceID1   = "5c13e113f17582641b3eaca090c387a6ce11f86f5ead096283e1d5a9e91e8937"; //
                string p12password = "******";

                string alert       = model.message + " at " + DateTime.Now.ToLongTimeString();
                string soundstring = "default";
                var    payload1    = new NotificationPayload(deviceID1, alert, model.badge, soundstring);
                payload1.AddCustom("custom1", model.message);
                var notificationList = new List <NotificationPayload> {
                    payload1
                };
                var push     = new PushNotification(bsandbox, p12fileName, p12password);
                var rejected = push.SendToApple(notificationList);
                model.IsResult = true;
            }
            catch (Exception ex)
            {
                model.MsgError.Add(ex);
                model.IsResult = false;
            }
            return(model);
        }