How to open Safari from ios app with specified cookies - ios

I want to open Safari from my iOS application with specified cookies. But i found that NSHTTPCookieStorage is not shared between apps in iOS. So i don't know how to do that. Please help.

I suggest to go with SFSafariViewController which will launch the web page inside your app and whatever the cookies you have those will be retained by SFSafariViewController without extra work.

Related

View set cookies of an iOS app?

I am trying to debug an iOS app without having the actual code.
It is using a ui web view, calling a website that sets cookies. I need to check which cookies are set. The problem does not appear in safari, only in the app, so I need to check the cookies of the app.
How can I do that? Is there a developer tool that can help me read the cookies similar to the safari web inspector?
Or do the developers have to use a certain framework to make the cookies readable?
Can I use xcode to debug an app - similar web inspector for safari - without having the code?
Thanks in advance for any hints.
This is kind of an old question but nevertheless relevant. So for the sake of posterity here's is how to connect an iOS mobile device to an OSX device to view web inspector.
https://appletoolbox.com/use-web-inspector-debug-mobile-safari/

when my app is not intalled, iOS universal link in UIWebView will launch Safari?

From Apple's guide in Support Universal Links:
When you support universal links, iOS 9 users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari.
But i'm confused that if my app is not installed,and I tap a universal link of my app in another app's UIWebView,will the system launch Safari app to load my website,or still load it in the UIWebView?
I test some app's universal links when the app is not installed,and they never launch Safari to load the next page ,they still load it in the UIWebView.
I want to konw if it's possible to launch Safari,but not stay in UIWebView.Do I need any configuration in apple-app-site-association file?
Actually I want to trace where my app was installed from by using cookie.I can store a cookie in Safari with informations of the download page,and get the cookie with SFSafariViewController when my app is installed and opened,and present different views according to the cookie.
What you are trying to build is called 'deferred deep linking'. This (plus a lot more) is exactly what we provide at Branch.io. If you want to avoid the headache of configuring it all yourself, give this a look. Apps like Pinterest, Airbnb, and Tinder all use us for this reason.
Apple's documentation is referring to the default behavior with the standalone Safari browser. Handling links inside an app with UIWebView supersedes this, and there is no way to automatically bounce out of the origin app into the main Safari app.
The workaround is to store data on your own backend. As you've discovered, relying on a cookie pass-through on the device itself won't work in many cases.

iOS UIWebView and Cookies storage

I use Cordova 4, Angular 1.4 and Ionic 1.3 to make a tablet app for Android and iOS.
When user synchronised datas, app opened another window (cordova-plugin-inappbrowser) and displayed our SSO webpage. When user ended to connect, window was closed and synchronisation was send again.
Android store session cookie when app is closed but iOS don't.
Each time user open app on iOS, he need to open window authentificator.
Is it a way to store much longer cookies on iOS ?
Thanks
EVURLCache may help you.
This is a NSURLCache subclass for handeling all web requests that use
NSURLRequest. (This includes UIWebView)
The EVURLCache is meant for handeling the following caching
strategies:
The app has to be functional even if there is no internet connection.
The app has to be functional right after the app has been downloaden
from the app store. (This means that the required content can be
included in the app.)
You do want to be a able to download new/updated
content if it's available.
Note:
Support: iOS 8+ OSX 10.9+ WOS 2+ TVOS 9+

How to close Safari from my App

Is that possible and if yes how can I close Safari which I had opened from my app itself.
If anyone knows please let me know. Thanks in advance.
You can't close other apps from your app.
But instead of opening Safari, you could open a view controller with a UIWebView to show the webpage you are opening in Safari.
Of course you cannot.Except that safari browser has some sdks you can use.But in that case you must register your app's url scheme in your app in my opinion.

How to force an iTunes URL to open in Safari on the iPhone?

I have the following URL which links to the product page of a Mac app. I'd like to provide this URL inside my iPhone app. However, it always launches the App Store and subsequently can't display the product because it's not an iOS app. How would I tell it to open in Safari? Is this even possible?
http://itunes.apple.com/us/app/appname/idxxxxxxxxx
Haven't found an answer, so opted for directing to Appshoper URL instead.

Resources