Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DEBUG preprocessor flag to conditionally disable assertions in prod #711

Merged
merged 1 commit into from
Aug 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Analytics/Classes/Internal/SEGAnalyticsUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ static id SEGCoerceJSONObject(id obj)

static void AssertDictionaryTypes(id dict)
{
#ifdef DEBUG
Copy link

@NachoSoto NachoSoto Sep 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be #if DEBUG.
If DEBUG is defined as 0 this would evaluate as true :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. However in practice that's not how most projects (including Pods.xcodeproj) are setup though.

assert([dict isKindOfClass:[NSDictionary class]]);
for (id key in dict) {
assert([key isKindOfClass:[NSString class]]);
Expand All @@ -159,6 +160,7 @@ static void AssertDictionaryTypes(id dict)
[value isKindOfClass:[NSDate class]] ||
[value isKindOfClass:[NSURL class]]);
}
#endif
}

NSDictionary *SEGCoerceDictionary(NSDictionary *dict)
Expand Down