New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headers need to be updated to include correct nullable and nonnull for Swift #507
Comments
Great, Thanks! I'll add this to our next release. |
Hey @jackfreeman - Not sure how you're seeing that? If you check out |
Hey guys, want to add notes to your updates here. The Example: Successful init calls However, failed inits return two empty objects, which is perhaps more unusual to handle. It might just be easier to make it nullable and return |
Thanks Graham! Interesting - do you see the nullability path for the majority use case ( |
I must have been looking at an older version of the headers, as I do now see the nullable flags. As mentioned by @shortstuffsushi though, it looks like the flag is set to |
I only found one instance of params being |
When I wrote these in the past, I wrote them with the expectation that the params would be nullable, in a time before that concept existed, or at least was popular enough that I took the time to incorporate it. I also at the time wanted to separate it out into two callbacks, which still hasn't been done (not sure if I ever shared that plan with anyone). I'd much rather see it be a success function, where non-nullable is accurate, and would always be the case, and separately a failure function, where you always have an error to work with. Kind of like the |
Fixed in SDK release 0.12.18. |
Right now none of the headers use the
nullable
andnonnull
keywords which can cause unexpected results when using the Branch SDK with Swift. See https://developer.apple.com/swift/blog/?id=25 for more info on these keywords and their usage.Specifically I'm seeing a crash from
initSessionWithLaunchOptions
if the Branch API cannot be reached. Due to not having thenullable
keyword, the params are returned as a force unwrapped optional, even though they are sometimes nil, which causes a crash when accessing them.callbackWithParams
in Branch.h should look like this to correctly integrate with Swift:The text was updated successfully, but these errors were encountered: