尝试在Roku通道中断开连接会引发错误

时间:2017-12-27 18:19:18

标签: roku brightscript

我正试图让callback method can't really return anywhere meaningful起作用。我已经在我的Roku棒上安装了通道,设置了用于生成和验证令牌的端点,但无法让断开端点工作。 sample auth linking Roku channel也没用,因为该页面上的回复与我从应用程序实际返回的内容不符。

我断开连接的代码如下所示:

{
    "success": "yes"
}

因此,从我的应用程序中,我将返回一个如下所示的JSON响应:

Suspending threads...
Thread selected:  2*   ...:/components/RegistryTask.xml(55)    
Current Function:
052:  sec.Write(key, val)
      Function RegWrite(key, val, section=invalid)
053:          if section = invalid then section = "Default"
054:          sec = CreateObject("roRegistrySection", section)
055:*         sec.Write(key, val)
056:          sec.Flush() 'commit it
057:        End Function
Type Mismatch. (runtime error &h18) in pkg:/components/RegistryTask.xml(55)
055:         sec.Write(key, val)
Backtrace:
#1  Function regwrite(key As Dynamic, val As Dynamic) As Dynamic
   file/line: pkg:/components/RegistryTask.xml(55)
#0  Function go() As Void
   file/line: pkg:/components/RegistryTask.xml(35)
Local Variables:
key              roString refcnt=3 val:"UNIQUE_ID_HERE3500X"
val              Invalid
section          String (VT_STR_CONST) val:"Default"
global           Interface:ifGlobal
m                roAssociativeArray refcnt=3 count:3
sec              bsc:roRegistrySection refcnt=1
Threads:
ID    Location                                Source Code
 0    pkg:/source/main.brs(15)                msg = wait(0, m.port)
 1    pkg:/components/SimpleScene.brs(78)     oauth_token: invalid
 2*   ...:/components/RegistryTask.xml(55)    sec.Write(key, val)
 3[u] ??
  *selected   [u]unattached(not debuggable)

但是在Telnet调试控制台会话中我得到了这个输出:

dat = numpy.genfromtxt("numbers.txt")

任何一个能够帮助我解读发生了什么和出错的人?

1 个答案:

答案 0 :(得分:1)

错误的直接原因是:

key              roString refcnt=3 val:"UNIQUE_ID_HERE3500X"
val              Invalid

Write()函数需要2个字符串,键和值 - 在这种情况下,值为invalid,没有用。

我快速浏览了示例应用程序,其背后的深层原因是onDisconnect()事件处理程序:

m.regTask.write = {
  deviceID: m.rokuDeviceID,
  oauth_token: invalid
}

必须以这种或那种方式修复。我没有查看更多细节 - 例如如果空字符串将对逻辑做或更好地使用roRegistrySection.delete()