Forum Discussion

MSGreg's avatar
MSGreg
Visitor
13 years ago

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?

3 Replies

  • 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.
  • 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"
  • 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.