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: 
MSGreg
Visitor

SetCertificatesDepth and avoid calling non-existent methods

I've used ifUrlTransfer.SetCertificatesDepth(3) in Version 4.7/4.8. It was required for communicating successfully to Dropbox over https.

A customer is reporting that my https communication is crashing my app on a Roku box running version 3.1.

What version(s) of BrightScript supports the ifUrlTransfer.SetCertificatesDepth(Integer) method?

Is there a way to verify the function exists before calling it?

Perhaps:

http = CreateObject("roUrlTransfer")
if http.DoesExist("SetCertificatesDepth") then http.SetCertificatesDepth(3) ' Does this work to prevent calling non-existent methods?
0 Kudos
3 REPLIES 3
TheEndless
Channel Surfer

Re: SetCertificatesDepth and avoid calling non-existent meth

SetCertificatesDepth is only available in 4.x, so you could just check the firmware version in your code to avoid calling it if the major version is less than 4.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
MSGreg
Visitor

Re: SetCertificatesDepth and avoid calling non-existent meth

Thanks, TheEndless

For the benefit of others reading this, DoesExist() method does not work to determine whether a method exists or not. (On further review after I posted, "DoesExist()" would have to be an implemented method on an interface to be usable, like it is on roAssociativeArray objects.

Here's the snippet that worked, based on TheEndless's suggestion. Version

' Example Version values are "4.08" and "4.07", NOT "4.8" and "4.7"!!
Version = Val(CreateObject("roDeviceInfo").GetVersion().Mid(2,4))
if Version >= 4 then print "Major Version 4 or above"
0 Kudos
OddScott
Roku Guru

Re: SetCertificatesDepth and avoid calling non-existent meth

Just a point of interest... I can confirm that SetCertificatesDepth() does exist in 3.1.1017 with roVideoScreen. Had the same problem with Dropbox, adding SetCertificatesDepth(3) corrected it. Was the first time I actually saw SetCertificatesDepth() actually do anything.
www.InstantTvChannel.com / www.InstantSubtitles.com - 717-441-4386 - Build a Roku SDK channel in 15 minutes! Easily and inexpensively generate subtitles!
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.