I use TestFlight for crash reporting and logging check points for testing in development. But for live app, I want to use crash reporting only.
To disable check points I can use preprocessor macro.e.g.
#ifdef TESTFLIGHT
[TestFlight passCheckpoint:#"Some event occurred"];
#endif
But problem with this approach is that I need to use this condition every time I send check point to TestFlight. I have around 70 check points.
I am looking for a way where I need to configure at one or two places in project and don't need to care about adding if condition for each new check point I add to project.
Please note that I do want to use TestFlight for crash reporting so I cannot completely disable TestFlight.
In some common header:
#ifdef TESTFLIGHT
#define TF_PASSCHECKPOINT(s) [TestFlight passCheckpoint:(s)];
#else
#define TF_PASSCHECKPOINT(s)
#endif
Then just say:
- (void)someFunction {
TF_PASSCHECKPOINT(#"entered someFunction");
...
}
Related
I am running Flutter integration tests on iOS Simulator using Bitrise.
Each time I need to start new instance of iOS. Due to Apple's privacy policy, I get the alert "Allow app to track your activity across other companies' apps and website?" on each new start of my app. And it blocks my tests.
I there a way to get rid of this alert on start of iOS Simulator?
How to disable the option with a single command?
There is something called a "pre processor flag" that you can use to wrap the code that executes in a special kind of if statement. By default you can do:
#if DEBUG
// do something if it's not production
#else
// trigger the alert
#endif
However, that won't let you test it manually on your device unless you build a production release. You can add special flags to your test target's build settings that will only trigger in that target.
Then we could write:
#if UITEST
// do nothing here
#else
// launch the alert
#endif
I have an app for iPhone and always sending a testing builds to client. At the same time I have an App Store version of this app. Client wants to have beta and stable app version on device at the same time. Is it possible to do without creating a new app with another bundle id?
You can only have on app on your device with the same BundleID.
If you want both the appstore version and a test version you will need to create a new BundleID for this test version.
I suspect you could do this using separate IDs for the debug and built app and using multiple schemes to share the code base between them.
Check out this article that will help
http://nilsou.com/blog/2013/07/29/how-to-have-two-versions-of-the-same-app-on-your-device/
--Edit--
Just noticed you specifically don't want different bundles due to Push Notifications. We got around this by letting our back end services know which app we were using, and targeting the different services based on which app they use. You can do this by defining preprocessor macros like this: Add preprocessor macro to a target in xcode 6
... then reference them just before you call your back end service to register your device like this...
#ifdef ENTERPRISE
env = GLOBAL_PushNotificationEnvironmentEnt;
#endif
#ifdef DEBUG
// In debug mode, the environment should be set to Development
env = GLOBAL_PushNotificationEnvironmentDev;
#endif
if (notificationsOnBool) {
[service RegisterPushNotificationTarget:self
TargetType:GLOBAL_PushNotificationTargetType
TargetToken:deviceID
DeviceName:[UIDevice currentDevice].name
EnvironmentType:env];
}
... then in your back end code you do something like this (psuedo-code)
if (device.env == Fabric) {
sendNotification(fabricService);
} else {
sendNotification(prodService);
}
How do I disable Parse Analytics during development. I tried commenting out the setApplicationId: clientKey: call but as there are events being tracked throughout my code this causes an exception.
Parse doesn't have a native functionality for disabling analytics during development, but you can wrap your events code using an #ifdef - #else - #endif statement
#ifdef DEBUG
#else
[PFAnalytics trackEvent:#"eventName" dimensions:#{ #"parameter": #"value" }];
#endif
As long as you are running with DEBUG enabled (dev environments), this event tracker will not run.
You may also need to check the settings for your build to ensure it is DEBUG mode. See this answer for help:
Xcode / iOS: How to determine whether code is running in DEBUG / RELEASE build?
I'm using the Facebook SDK to track ads mobile install and followed this tutorial: mobile ads install
So far, events in DashBoard / Insight are not separated for debug / prod mode.
Do I have to create 2 appIDs to separate the debug and prod events in DashBoard/Insight ?
My guess is to you use the DEBUG preprocessor macro (or create a new one if needed), to set the correct Facebook's appId for you build. You can use the method FBSettings setDefaultAppID: from Facebook SDK to reach this, without hardcode the appId in the Info.plist.
Let me write a simple example:
// 1 - Set the app id on compile time, based in macro you choosed
#if DEBUG
kFacebookAppID = #"your app id for debug";
#else
kFacebookAppID = #"your app id for production";
#endif
// After then, you can set the id in your app delegate initialization
[FBSettings setDefaultAppID:kFacebookAppID];
I hope this help you.
We successfully use TestFlightLive as our crash reporter, but I think some features are missing. These missing features are in another crash reporter: Crashlytics, but as of now I'm not willig to switch crash reporters completely. So I wonder if it's possible to use these both crash reporters together in one app (which is meant to be in the app store in the future).
I run both TestFlight and Crashlytics together and they both report errors fine. Like Jens Kohl says above, it must be included after the TestFlight SDK is initialized. Here's my code:
#ifdef DEBUG
// setup testflight if in debug (ie dev) mode
[TestFlight takeOff:kTestFlightAPIKey];
#endif
[Crashlytics startWithAPIKey:kCrashlyticsAPIKey];
You can only use 1 crash reporting framework. The framework catching the crash lets the other framework either not catch it or get wrong data since there is already new code executed on the thread.