Pregunta

I want to cast FB::variant to FB::JSObjectPtr. below is my code

void PluginAPI::Test(FB::variant testVariant)
 {
     FB::JSObjectPtr jsObject=testVariant.convert_cast< FB::JSObjectPtr>();
 }

the above casting throws the Access violation Exception. Please let me know for the solution.

¿Fue útil?

Solución

I don't know why an access violation exception would be thrown, but in general the most likely reason for this would be that it isn't actually a javascript object that is getting passed in.

Why are you doing a convert_cast inside the function? Just rewrite the function to:

void PluginAPI::Test(const FB::JSObjectPtr& jsObject)
{
    // use it here
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top