How do I get Instagram’s web view to ask permission for user’s current location? - webview

My website is most likely opened by users directly from the Instagram app. The problem is a key feature of my website is its geolocation capability, and the Instagram app web view seems to block the usual request for the user’s permission to activate this functionality.
It is unlikely that a user will take the time to click ‘…’ menu and then ‘open in browser’, so I am hoping there is a way to enable the geolocation permission request within Instagram’s web view?
Or alternatively, utilise the same code Instagram uses to ‘open in browser’ to pop-up and enable user to exit web view in less clicks?
Thank you!

Related

iOS 11 Facebook SignIn is showing an initial system alert

Preparing an app for iOS 11, I noticed there is a system alert showing up every time the user click on the "Facebook login" button. Does somebody know how to prevent this alert from appearing?. Now Social Networks integrations have been removed from the system and together with the Safari View Controller cookies storage changes (to not be shared) it sounds Apple has also added this extra alert to the sign up - sign in flow whenever you try to connect with Facebook. Has some body experienced the same issue in your apps?. Thanks for your comments.
It's not an issue. It's by design. Part of the authorization workflow when working with SFAuthenticationSession in iOS 11+ and you can't avoid it since it's a user permission request.
If an application uses SFAuthenticationSession, users are prompted by a dialog to give explicit consent, allowing the application to access the website's data in Safari.
SFAuthenticationSession docs

Can I get location access without generating the default popup in iphone?

I am working on an app that requires location access. I created a view controller asking the user to allow or not with 2 buttons. But when I click the allow button, device is generating it's own popup asking the user for location access. Can I avoid the popup and just add the functionality of allow in popup into my code for the allow button in my app itself?
No you cannot avoid system popup. As per apple
Always request authorization at the point where you actually plan to
use location services to perform a task. Requesting authorization may
display an alert to the user. If it is not clear to the user that your
app is using location services for a useful purpose, the user may deny
your request to use those services.
Also, It is safe to start location services before the authorization status of your app is determined. Although you can start location services, those services do not deliver any data until the authorization status changes to authorizedAlways or authorizedWhenInUse. To be notified when the authorization status changes, implement the locationManager(_:didChangeAuthorization:) method in your location manager delegate.
Sorce
No, Not possible in Apple device yet.

Can WKWebView persist location services permission?

I'm writing an ios app which is mostly implemented in a web view, and runs inside a native app.
Is there a way to persist the granted permission across web view sessions or must the user grant permission in the web view each time the web view loads within the native app? Asking the user to re-authorize the same website over and over creates a very poor user experience.
I have read the documentation for UIWebView and WKWebView, but haven't found any mention there, nor any mention on stackoverflow to date, so perhaps I'm asking the community to help me prove a negative here :) Any input would be appreciated.

Access photos with AssetLibraryPhotosViewer

I'm trying out this code: http://github.com/akpw/AssetLibraryPhotosViewer to access photos on my iPhone.
However when I run the application, I get an alert that says the application is trying to access my photos - and then I can allow this or decline.
Can I disable this when using the AssetLibrary, or does this message always appear?
If I can't turn this off, and I press "Don't Allow", can I still make the app access my photos?
Following on from answer above. This will appear once. If you allow access then it will not show again and you will have access to the photo's. If you disallow it then you will not be allowed to access this and the alert dialog will not appear again.
This permission can be changed at any time by the user in the settings app (Under Location and Privacy, or a variation of that.) This has been around since iOS 6 I believe.
You are never able to programtically state that access has been granted, the system handles the permissions which are shown to the user.
This is a security feature of the OS that cannot be disabled. If a user does not give your app permission to access the photo library your app will not be able to access any photos. Given this ability your app should be able to handle the situation gracefully from a UI/UX perspective.
For more information take a look at this guide from Apple about iOS security guidelines (page 47 takes about accessing personal data) iOS Security

iOS Facebook switches back to app between login & permissions

I'm trying to setup my app to publish a simple post to a user's Facebook feed (image url, link, description). They don't need to use Facebook for anything else so the first time they click "Share" it needs to authorize the app, and the publish permissions.
If they have their credentials stored in the device as of iOS 6 they simply get two alert boxes and it's done with. But if they don't, or have an older version, it switches out to Safari for login. My problem is that it is then switching the user back to my app, then immediately back again to Safari to accept the publish permission. It's very jarring and unprofessional.
What I would like is for the page in Safari to change after the login to the permissions page so they can accept it, and THEN switch back to my app. I know this can be done because the popular Mixology app does exactly this behavior. Unfortunately Facebook keeps changing their SDK and all the information I find online is outdated.
I wrote up a solution here: FacebookSDK presents login UI twice to avoid the double switch.
Basically, you can use openActiveSessionWithPublishPermissions: to do what you want. However, you have to handle the special case where the user has signed in to Facebook from the device settings, which requires requests for read and publish permissions into two separate calls.

Resources