问题描述:

I need to switch between production and sandbox when using PushSharp.

Below is the line of code that causes me the issue :-

var config = new ApnsConfiguration(ApnsConfiguration.ApnsServerEnvironment.Sandbox, @"[CERTPATH]","[PASSWORD]");

The certificate path and passwords are stored in the web.config which means i can easily change these setting when deploying to production.

Its changing the ApnsServerEnviroment i also need to be able to configure :-

ApnsConfiguration.ApnsServerEnvironment.Sandbox

In the future i want to implement PushSharp notifications as a service. But for now, its simple a class inside an application.

网友答案:

Just making my comment an answer: just make an app setting for the environment and make an if clause that checks the environment setting, and based on that chooses sandbox or production.

相关阅读:
Top