Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
neowinston
Visitor

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 2
renojim
Community Streaming Expert

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
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos
neowinston
Visitor

Re: roRegistrySection writing crash

I changed it to a Task node and now it's working! Thanks for your help!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.