I don't want to include hockey sdk in my app store version. As a result, I create two target and for app store target, I don't include hockey sdk. In my app delegate, I write like this.
#ifdef DEBUG
#import <HockeySDK/HockeySDK.h>
#elif RELEASE
#import <HockeySDK/HockeySDK.h>
#elif DEVHOCKEY
#import <HockeySDK/HockeySDK.h>
#endif
if (ENV == ENV_DEV || ENV == ENV_PROD_WITH_DEV_HOCKEY || ENV == ENV_PROD) {
[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:HOCKEY_KEY];
[[BITHockeyManager sharedHockeyManager] startManager];
[[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation];
[[BITHockeyManager sharedHockeyManager].feedbackManager setFeedbackObservationMode:BITFeedbackObservationModeThreeFingerTap];
}
else if (ENV == ENV_APPSTORE) {
}
Problem is that when I run or archive for app store target, it say "Use of undeclared identifier BITHockeyManager". How shall I do to exclude hockey sdk and their code only for app store version?
It is not correct to exclude a lib in this way. In order to get the Complier work for your code, you need to always import HockeySDK/HockeySDK.h.
I have two suggestions to meet your requirements:
Solotion 1: Build two separate apps, one for pre-release test which can distributed via HockeyApp; the other for Apple Store Release without importing HockeyApp.
Solution 2: Keep one build with HockeyApp integrated. The HockeyApp SDK should check for the existence of a provisioning profile in the App bundle to detect the AppStore environment and then automatically disables all beta only features of HockeyApp. (i.e. "In-App-Updates" in the iOS SDK (for Beta & Enterprise only) are automatically disabled when running in an App Store build by default. You can refer here for more information.