Using WonderPush in both development and production versions of your application requires 2 WonderPush projects.
- An iOS Universal push certificate. You can also use a sandbox certificate for the Development environment.
Create two WonderPush projects: one for the development environment (let's call it MyApp - development) and one for the production environment (MyApp - production).
Upload the appropriate iOS push certificate to each WonderPush project by following steps 1 & 2 of our iOS Quickstart.
When your app launches, it initializes WonderPush with the
setClientId:secret: method. We'll use a conditional to switch between development and production:
#if DEBUG WonderPush.setClientId("DEVELOPMENT_PROJECT_CLIENT_ID", secret:"DEVELOPMENT_PROJECT_CLIENT_SECRET") #else WonderPush.setClientId("PRODUCTION_PROJECT_CLIENT_ID", secret:"PRODUCTION_PROJECT_CLIENT_SECRET") #endif
#ifdef DEBUG [WonderPush setClientId:@"DEVELOPMENT_PROJECT_CLIENT_ID" secret:@"DEVELOPMENT_PROJECT_CLIENT_SECRET"]; #else [WonderPush setClientId:@"PRODUCTION_PROJECT_CLIENT_ID" secret:@"PRODUCTION_PROJECT_CLIENT_SECRET"]; #endif
Now whenever you launch your app via Xcode, the development project will be used, and when you'll distribute your app on the AppStore, the production project will be used.
Updated almost 3 years ago