I’m looking to uniquely identify an iPhone so our server can respond with some custom html. I want to be able to identify the phone in Safari and in an embedded browser in the app. Since each application is sandboxed, cookies won’t work.
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is actually very hard.
You could program the app so that it launches Mobile Safari when it first opens and sets a cookie, then redirects back to the app using a custom URL scheme.
That may seem weird but it’s actually how Facebook’s shared login system works and it allows both the app and the browser to “break out” of their sandboxes and share the same unique cookie ID.
Of course you wouldn’t know if the user had deleted the cookie unless you do the redirect every time the app launches, which might get annoying.
UPDATE:
As of iOS 9, you can now open the page using
SFSafariViewControllerinside your app instead of redirecting to the Safari app. This is still a bit clunky, but may be preferable to a double app switch.