Binya Koatz
Binya Koatz

Reputation: 139

HTTPCookieStorage's setCookies method says URL is optional but fails if you pass in nil

Hey so I'm trying to use the setCookies method in HTTPCookieStorage, and I see that the URL parameter is "optional", but when I pass in nil, it calls CFURLCopyHostName, which implicitly unwraps the URL and the call breaks.

I'm okay adding a URL, but it's a little clunky in my code, and I'd prefer not to. Has anybody else run into this? And if so, why do they mark the URL parameter as "optional" if it's going to implicitly unwrap it anyway? Is there something specific about my cookies that might make the URL field get unwrapped, when in other cases, with different cookies, the code might not unwrap it?

Thanks

Stack trace for unwrapping crash

Upvotes: 1

Views: 235

Answers (0)

Related Questions