which compiles OK, and was supposed to either return the non null string, or “NULL”… and print it out…
but which actually crashed on Android when we ran it.
changing to the thisWorks case where we don’t use the guard var, but use the parameter again…
works fine.
I don’t recall if they all crashed… or just the ones where blah was in fact optional
so I would check
var s1: String?
var s2: String? = "xyz"
var s3 = “abc”
public class UtilTests
{
static func thisBuildsButCrashesAtRuntime(_ any: Any?) -> String
{
guard let a = any
else { return “NULL” }
return "\(a)"
}
public func testForFireAny()
{
print("\(UtilTests.thisBuildsButCrashesAtRuntime("blah"))")
let blah = "blah"
print("\(UtilTests.thisBuildsButCrashesAtRuntime(blah))")
}
}
this works fine in swift… (Xcode)…
but if I build that in Fire and run it on Android…
Error in testForFireAny:
com.remobjects.elements.system.DynamicInvokeException: No overload with these parameters
at com.remobjects.elements.system.DynamicHelpers.Invoke()
at com.remobjects.elements.system.DynamicHelpers.Invoke()
at blah.UtilTests.thisBuildsButCrashesAtRuntime(…)
at blah.UtilTests.testForFireAny(…)
won’t that always work? it’s just a literal string…
I assume you meant this… (but maybe you did do this, but the editor took out the backslash when you posted here?)
but then I don’t see a variable called blah anywhere… so I don’t see how your code could compile if you did…