How to share cookies from my ios app to mobile saf

2019-05-11 11:31发布

问题:

I use asiHttpRequest library to do data get and post.

I have built a login function with it to login to my site, after that, if I launcher a URL from my app to use mobile safari app browse the site, it still remains not authenticated.

I guess the reason is that my app does not share the same cookie storage with safari, is that correct? is that possible I share the cookies with other apps, especially the Safari?

回答1:

You can NOT share cookies in your App with Mobile Safari. As @erpayo said, it's in Sandbox.

Maybe add a UIWebView into your App is the best solution. Do not open an URL in Mobile Safari but open it in the UIWebView. It can get your cookies.



回答2:

no, it's not.

Cookies are sandboxed.

Maybe you can make some server side tracking using query string parameters, but it will become a security hole