Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
neowinston
Level 7

roRegistrySection writing crash

I'm using roRegistrySection to save and later retried a string, but the app is crashing when trying to write or read the data. Here is the code and below is the error log:

Writing:


BRIGHTSCRIPT: ERROR: roRegistrySection: no plugin instance available: pkg:/components/screens/DetailsScreen/DetailsScreen.brs(122)


Function SetAuthData(userToken As String) As Void
    sec = CreateObject("roRegistrySection", "Authentication")
    sec.Write("UserRegistrationToken", userToken)
    sec.Flush()
End Function


Reading:


Function SetAuthData(userToken As String) As Void
    sec = CreateObject("roRegistrySection", "Authentication")
    sec.Write("UserRegistrationToken", userToken)
    sec.Flush()
End Function



Error log:

Current Function:
118:  Function SetAuthData(userToken As String) As Void
119:      sec = CreateObject("roRegistrySection", "Authentication")
120:*     sec.Write("UserRegistrationToken", userToken)
121:      sec.Flush()
122:  End Function
'Dot' Operator attempted with invalid BrightScript Component or interface reference. (runtime error &hec) in pkg:/components/screens/DetailsScreen/DetailsScreen.brs(120)
120:     sec.Write("UserRegistrationToken", userToken)
Backtrace:
#1  Function setauthdata(usertoken As String) As Void
   file/line: pkg:/components/screens/DetailsScreen/DetailsScreen.brs(120)
#0  Function onitemselected() As Void
   file/line: pkg:/components/screens/DetailsScreen/DetailsScreen.brs(100)
Local Variables:
usertoken        roString (2.1 was String) refcnt=1 val:"English"
global           Interface:ifGlobal
m                roAssociativeArray refcnt=3 count:6
sec              Invalid
Threads:
ID    Location                                Source Code
 0    pkg:/source/main.brs(21)                msg = wait(0, port)
 1*   ...ailsScreen/DetailsScreen.brs(120)    sec.Write("UserRegistrationToken", userToken)
  *selected


What is happening? Please help. Thank you!
0 Kudos
2 Replies
renojim
Level 10

Re: roRegistrySection writing crash

What's happening is that CreateObject("roRegistrySection", "Authentication") is returning invalid.  If I had to guess, I'd say you're trying to call it in some node that is not a Task node.

-JT
0 Kudos
neowinston
Level 7

Re: roRegistrySection writing crash

I changed it to a Task node and now it's working! Thanks for your help!
0 Kudos