Пример #1
0
        static void Main()
        {
            IClientProfile         clientProfile = DefaultProfile.GetProfile("cn-hangzhou", "<your access key id>", "<your access key secret>");
            DefaultAcsClient       client        = new DefaultAcsClient(clientProfile);
            PushNoticeToiOSRequest request       = new PushNoticeToiOSRequest();

            request.AppKey = < your appKey >;
            // iOS的通知是通过APNS中心来发送的,需要填写对应的环境信息. DEV:表示开发环境, PRODUCT: 表示生产环境
            request.ApnsEnv       = "DEV";
            request.Target        = "ALL";
            request.TargetValue   = "all";
            request.Title         = "iOS Notice Title";
            request.Body          = "iOS Notice Body";
            request.ExtParameters = "{\"k1\":\"v1\",\"k2\":\"v2\"}";
            try
            {
                PushNoticeToiOSResponse response = client.GetAcsResponse(request);
                Console.WriteLine("RequestId:" + response.RequestId);
                Console.WriteLine("ResponseId:" + response.MessageId);
                Console.ReadLine();
            }
            catch (ServerException e)
            {
                Console.WriteLine(e.ErrorCode);
                Console.WriteLine(e.ErrorMessage);
                Console.ReadLine();
            }
            catch (ClientException e)
            {
                Console.WriteLine(e.ErrorCode);
                Console.WriteLine(e.ErrorMessage);
                Console.ReadLine();
            }
        }
        public static PushNoticeToiOSResponse Unmarshall(UnmarshallerContext context)
        {
            PushNoticeToiOSResponse pushNoticeToiOSResponse = new PushNoticeToiOSResponse();

            pushNoticeToiOSResponse.HttpResponse = context.HttpResponse;
            pushNoticeToiOSResponse.RequestId    = context.StringValue("PushNoticeToiOS.RequestId");
            pushNoticeToiOSResponse.MessageId    = context.StringValue("PushNoticeToiOS.MessageId");

            return(pushNoticeToiOSResponse);
        }