Home Tutorials Download Beta Store Forum Documentation KnowledgeBase Wiki Blog

ShiVa3D

Return to Plugins

S3DX::application.getCurrentUser() returning NULL in plugin

ShiVa Plugin Development

S3DX::application.getCurrentUser() returning NULL in plugin

Postby flippout » 25 Nov 2011, 22:49

Hey all, I'm hooking up In-app purchase through my plugin. I'm seeing a strange issue where S3DX::application.getCurrentUser() seems to return nil. I'm wondering if this might have something to do with where I'm calling it from - it's in an NSNotificationCenter-triggered event, in the main thread.

Has anyone ever dealt with anything like this before?
flippout
Gold Boarder
Gold Boarder
 
Posts: 279

Re: S3DX::application.getCurrentUser() returning NULL in plugin

Postby NiCoX » 26 Nov 2011, 00:52

Hi,

S3DX API functions must be called from within a plug-in function (same thread, same calling context). So you need to store the notification somewhere (a global variable or better a singleton/manager, or even the plug-in derived class), and check it each frame from a plug-in function or from the "OnEngineEvent" function.
User avatar
NiCoX
Platinum Boarder
Platinum Boarder
 
Posts: 5627
Location: France

Re: S3DX::application.getCurrentUser() returning NULL in plugin

Postby flippout » 26 Nov 2011, 01:02

Cool, thanks for the quick reply!
flippout
Gold Boarder
Gold Boarder
 
Posts: 279


Return to Plugins