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

NullReferenceException trying to clear tracker parameter (iOS) #161

Open
nicolasjinchereau opened this issue Oct 4, 2017 · 0 comments
Open

Comments

@nicolasjinchereau
Copy link
Contributor

To clear a parameter, you should pass nil to value:

@param value The value to set for the parameter. If this is nil, the
value for the parameter will be cleared.
*/
- (void)set:(NSString *)parameterName
value:(NSString *)value;

But first, this call is made, which calls +(NSString)stringWithUTF8String on value, which will throw when null is passed.

void set(const char * parameterName, const char * value ) {
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
[tracker set:[NSString stringWithUTF8String:parameterName]
value:[NSString stringWithUTF8String:value ]];
}

But before calling those two, you must call this in C#, which calls ToString() on the value without checking if it's null.

public void _set(string parameterName, object value){
set(parameterName, value.ToString());
}

Finally, SetTrackerVal, which should be able to accept null to clear parameters, but crashes due to aforementioned problems.

public void SetTrackerVal(Field fieldName, object value){
handler._set(fieldName.ToString(), value);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant