ODWEventProperties accepting `Any` object for setProperty:(NSString)name value:(id)value
There is a bug in ObjC wrapper -> ODWEventProperties expose function of setProperty:(NSString)name value:(id)value. Looking at the comments this method should be only for Strings but the definition is using id instead of NSString.
This function definition lead our team to think that passing Any object OneDS would try to cast to primitives (Double, Bool, etc) and would return if cast failed. However, we ran into crashes for passing non primitive properties to this method.
I know it was our bug for assuming OneDS would handle this, however the API method definition is very risky to have it receiving Any. Could lead to confusion and crashes in other clients.
Steps to reproduce. Pass a non primitive object to this API and it crashes while unwrapping properties
What is the expected behavior?
The API should restrict its use for NSString only setProperty:(NSString*)name withStringvalue:(NSString*)value
What is the actual behavior? The API allows to pass any object. Even if clients should be responsible to cast external properties to primitive its important to have clear method definitions (also would give us an extra help from the compiler 😉)
@kindbe @eduardo-camacho @thomasameisel - need your feedback on this.
I agree with @EduardoVaca, I prefer that the function takes in a NSString instead of id. This makes it more clear what types of values the framework supports. It's also in line with the legacy Aria SDK headers.
Documentation states caller should pass an string, but better to enforce type and prevent mishandling. Agree this is something we want to fix.
@eduardo-camacho is the type enforcement something that the C++ side of the code does? If not, I'm hesitant to recommend deviating from the behavior of the SDK depending on the wrapper. If it does do the enforcement, then I agree that we should fix it.
@thomasameisel, is this a blocking issue or a wrapper improvement issue?
@sid-dahiya the type enforcement would happen in the objc wrapper. Changing this parameter to NSString would bring this function in line with the other functions on the class since they specify the type (int64_t, NSDate, UUID, etc).
@EduardoVaca actually opened the issue so I'm not sure for him. It's not a blocking issue for me/Outlook.