有没有办法知道程序是否在开发环境中运行?我正在使用 Flurry Analytics 并想向它传递一个不同的应用程序 ID,这样数据就不会在开发过程中被我的测试弄脏。
我想要的是这样的:
Boolean isDevEnv = .... (is this a test in the simulator or device,
OR is it a real user that downloaded the
app through the app store?)
if (isDevEnv)
[FlurryAnalytics startSession:@"firstAppId"];
else
[FlurryAnalytics startSession:@"secondAppId"];
要清楚,this这不是我想要的,因为我使用真实设备和模拟器进行测试。
最佳答案
在build设置中,您必须根据构建环境设置标志。
然后,使用#ifdef 和#define 设置appid。
#ifdef DEBUG
# define APPID ...
#else
# define APPID ...
#endif
关于objective-c - 了解应用程序是否在测试环境中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10757532/