Skip to content

Prevent setUserId nil log #343

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

Merged
merged 5 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 7 additions & 1 deletion Agent/Analytics/NRMAAnalytics.mm
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,13 @@ - (BOOL) setSessionAttribute:(NSString*)name value:(id)value persistent:(BOOL)is
[](bool) { return true;});
return _analyticsController->addNRAttribute(attribute);
} else {
NRLOG_AGENT_ERROR(@"Session attribute \'value\' must be either an NSString* or NSNumber*");
if (name == kNRMA_Attrib_userId && !value ) {
NRLOG_AGENT_VERBOSE(@"Successfully set userId to nil");
return YES;

}else {
NRLOG_AGENT_ERROR(@"Session attribute \'value\' must be either an NSString* or NSNumber*");
}
return NO;
}
} catch (std::exception& error) {
Expand Down
4 changes: 4 additions & 0 deletions Agent/Analytics/NRMASAM.mm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ - (BOOL) checkAttribute:(NSString*)name value:(id)value {
BOOL validAttribute = [attributeValidator nameValidator:name];
BOOL validValue = [attributeValidator valueValidator:value];

if (name == kNRMA_Attrib_userId && !value ) {
NRLOG_AGENT_VERBOSE(@"Successfully set userId to nil");
return YES;
}
if (!(validAttribute && validValue)) {
NRLOG_AGENT_VERBOSE(@"Failed to create attribute named %@", name);
return NO;
Expand Down
Loading