If I want to send a user to the facebook settings page under "system preferences" from within my app, what is the best possible way to do that, if it is indeed possible:
A case where this is useful would be if a user is trying to use an app's SSO capabilities to register for something using their facebook account. They click to register using facebook, but no facebook account is configured on the iPhone. It would be useful to then display a UIAlertView explaining that there is no facebook account configured, and then send the user to the settings page for facebook.
Is this possible? If so, how?
Short answer, Its not possible.
There is no way to launch device default "Settings" app from within your app. All you can do is give user some instructions of how to go about and change certain settings by themselves. You can do this as either a pop-up alert message or some sort of tutorial with screenshots built in your app.
Related
I am trying to get the Accounts Framework to give me a user's twitter handle.
This works if the user had previously logged on to twitter with their iPhone.
However, if they have never associated their account with their iPhone, I can't find a good way to prompt them to do so.
The method ACAccountStore.renewCredentialsForAccount does take them to settings to re-enter their password, but I don't see a way to take them to that settings screen to enter a new account.
As to me, the best solution for you right now is to make an UIAlert that tells something like:
"Please go to your Settings > Twitter and login...thanks"
As currently there is no URL to Twitter/Facebook settings page in iOS.
The only settings page in iOS Settings you can open from your app — is your app's settings page.
You can do that by calling:
UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString))
In my app I'm using the Social framework to share status updates on Facebook and Twitter through an SLComposeViewController.
If the user doesn't have an account set up, he receives an alert that lets him go to the settings page.
Is there a way to automatically return to my app after setting up the account?
Simply put: no.
There is no call of action to navigate the user from settings to your app. You have to have faith the user will navigate to your app
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.
Apps that allow users to log in over a 3rd party authentication provider (e.g. Facebook, Google, Twoitter,...) should open a browser window to let the user authenticate against the provider. That means, at some point, an app is backgrounded and the user interacts with a browser window. Just before the browser opens, it's a recommended pratctice to inform the user about what will happen (see e.g. Getting Started with OAuth 2.0 - O'Reilly), let's say an alert window with something like "you will leave now the XYZ app and a browser window will open where you can enter your credentials safely".
My question: How can that be done if I use the facebook SDK for ios? Looking at the SDK, there seem to be no notifications and no designated states that would allow me to detect that the sdk is about to background my app and about to opening either Safari or the Facebook app.
Use a simple alert that explains what will happen when pressing the button (or however you choose to do it). And when the user has pressed the OK on the alert sign them in.
However I'm quite certain that in Facebook terms of service you have to have some sort of Facebook trademark before interacting with facebook and it seems like standard practice to mention facebook in some way on a button and then log-in the user without mentioning it, since it plays on the user expectation.
Especially when using iOS 6.0 and Facebook SDK 3.1 for iOS, then Facebooks SDK takes care of most of that in it's own.
Does anybody know a smart way to bring the user to enter their Facebook or Twitter account login information, if they aren't already logged in? For example, a user tries to log in my application with Facebook without configuring the Facebook account in the iOS settings. Can I ask him to do it with an alert, for example, but how can I bring him to the exact section of settings for that?
#rckoenes is correct. Under normal circumstances there is no way to manually send the user to preferences. There was a method of doing this introduced in iOS 5, but Apple quickly depreciated it in iOS 5.0.1 or 5.1 I don't remember exactly which one.
Now, on to the current situation. If you are using an SLComposeViewController in the Social Framework, you don't even have to worry about adding this functionality yourself. It is done automatically by iOS. Below is a screenshot from my 6.0 simulator attempting to post to Facebook without any accounts signed in. This is also true for Twitter and Sina Weibo.
You can't, there is no way to get the user to the settings app lett a lone the correct section.