How do I get Facebook to return to my app after login if using phonegap plain on iPhone? - iphone

I have a phonegap app that I use the Facebook plugin to implement single sign on. I registered am a native iPhone app since the app is not run in the browser. When I click on login I get an invalid URL error message. I suspect my problem is either I need to specify a URL which I have tried using channel in init but I get a URL not allowed with this configuration. The other problem may be that I need to register this application as a web app. However using phonegap the application does not have a url. I don't know what to do.
Any help is appreciated.
Thanks!

Did you look at the iOS URL scheme section of the Plugin's readme?

Related

iOS: google+ sdk redirects to google.com after giving google+ permission instead of redirecting back to app

I am trying get google+ to go back to my app after the user gives it permission just like the sample app that is included in the iOS google+ sdk, however it redirects to google.com instead. Anyone know what I did wrong or what to do?Any tips will be appreciated.
The way Google gets back to your app is via a custom URL scheme, which is normally your bundle identifier, hence Wain's question.
You'll need to set that up in both your Info.plist (or the Project settings) as a custom URL scheme, and in the API console for the client ID for your project.
For adding to your app: https://developers.google.com/+/mobile/ios/getting-started#step_4_add_a_url_type
For adding to the API console: https://developers.google.com/+/mobile/ios/getting-started#step_1_creating_the_apis_console_project
Make sure both of those have the same value, then the sign-in should be redirected to your app properly.

How to implement my android algorithm on iOS?

I have an android app working this way:
User read QR-code with my specific URL
If the app installed it intercepts this URL and handles it somehow.
If app not installed standard browser opens this URL and it leads to Google play on app page.
When user install and run app first time it read browser's history and look for my URL.
If app found URL in browser's history then it handles this URL again.
Is it possible to implement this behavior on iPhone/iPad?
I suppose key features here are to read browser history and to intercept http URL's.
If this is impossible how would you implement this thing on iOS?
Thanks in advance for your help.
You can use custom application URLs in the form: myApp://... iOS will automatically launch the application if present. The logic for handling the 'not-installed' case has to be in the QR code scanning app. can be handled by the scanned website via a forwarding link using the iOS custom URL scheme (this might be useful for usage stats).
Additional info on implementing Custom URLs...

oAuth2 Issue in Salesforce PhoneGap iPhone Application (Remote Access Application Authorization Issue)

I have created an iPhone application using PhoneGap. I have followed code from this tutorial:
Building PhoneGap Mobile Applications Powered by Database.com
I have logged in successfully and got struck in this screen:
I am unable to move to other screens to access data. Here is the url that got generated after successful login:
https://login.salesforce.com/services/oauth2/success#access_token=0000&refresh_token=0000&instance_url=https%3A%2F%2Fna12.salesforce.com&id=https%3A%2F%2Flogin.salesforce.com%2Fid%000C&issued_at=0000&signature=qqqq&scope=id+api+refresh_token
Do I need to add cosumer key to this url? Here is my callbackurl:
https://login.salesforce.com/services/oauth2/success
What would be the problem? Did I miss anything?
So https://login.salesforce.com/services/oauth2/success is a stub URL for callbacks - and that is the screen you are seeing there, and the access_token variable is your session ID for the user. So the OAuth flow is working correctly.
In the code, you might check to see if:
oauthResponse.access_token
Is getting set correctly. If so it looks like:
sfw.login( setupHomeView );
Is what should tell it to move from that page to the next UI page.
You might also check out the Force.com Mobile SDK:
http://developer.force.com/MobileSDK
It also includes PhoneGap and has a great OAuth wrapper built in.

Facebook Connect Open native facebook App,

I have an iPhone app using facebook connection using FBConnect from github code.
It worked fine in the simulator, however when I installed it in the device with existing facebook app from facebook it didn't work. It opens the existing facebook app instead of returning to my own app.
Checkout this link.
Better you can go with the approach given in the link as it works fine. I have myself tried this code and it has worked for me.
Also the sample project (with Facebook API implemented in it) is given in the below link which will be helpful for you to while implementing the facebook API as per the method given in the below link.
http://www.raywenderlich.com/1488/how-to-use-facebooks-new-graph-api-from-your-iphone-app
Also you can test the sample project on your device before going for this approach
Hope this helps you.
EDIT:
Have you registered a URL handler to respond to return requests from the Facebook app? on iOS 4 the Facebook SDK uses fast app switching which is designed to let the app handle most of the heavy lifting and let the users just hit "Accept" instead of having to re-enter login/passwords

Catching an exception when trying to launch a URL service from within Safari on an iPhone

I was wondering if anyone knows - if I have an iPhone app that is registered with a URL service (e.g. alocola://), which means another app can invoke it by calling its URL - is there any way to embed this URL in an HTML page, and catch the exception if the app is not installed on the user's iPhone?
Or in other words / more details:
I would like to write an app that conforms to some URL invocation (like alocola:// is doing), but would like this app to be launched from a web page read by mobile Safari. However, if the app is not installed on the user's iphone, I would like to be able to display a note saying "you must have the alocola app installed on your iPhone, please download it from the app store by clicking here". Is there a way (perhaps using javascript) to have Safari indicate that the URL cannot be invoked, and catch this in order to display an intelligent message?
Thanks :-)
Ariel
No, there's no way to detect this and display such a message. Instead, you should put text on the webpage saying that the using the link requires your app.