iOS Best way of including Facebook "Like" in app?

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
8,698
4,319
Alright, this is what I've done so far,

I went on Facebook's Developer pages, looked around, found a tool that automatically generates the HTML5 code for a "Like" button. I got the code, stuck it in an HTML file, and put that file in my app's bundle. Then I added a UIWebView and had it load the HTML file.

Run the app. Give it a few seconds to load and the "Like" button appears. Tap it, it pops up the mobile Facebook login screen. Type in your email and password, hit the login button, and then the view becomes mostly white except for a blue Facebook mobile banner across the top of the screen.

The old issue, I have a new one added in my edit:
Why is the Facebook banner staying there? I'd much prefer if it returned to my HTML file once it's done with the log-in.

I'm also having some issues positioning the button... any suggestions on how to move it around would be nice. I'd like it to be centered, but all I seem to be able to do is define how far it is from the left side of the screen.

Edit:
This all still looks very ugly, but I've gotten the button to reappear. What I did was I set up a delegate for my UIWebView, and when it receives a message that the UIWebView is about to submit a form, it sets a timer for five seconds. After those five seconds*, it loads the HTML page that it started on.

The New Issue:
When the button comes back up, all that has actually happened is the user has logged on. The user hasn't actually "Like"d the app yet, even though they already hit the button. If they hit the button again (now that they're logged on,) it'll work properly. Any suggestions how to make it automatically hit the "Like" button for the user after they've logged on?

*Initially I was trying to do it without waiting, but I had the issue that it didn't seem to actually log on (no matter how many times I'd enter the info, it wouldn't let me hit the like button, it would just ask for my log in again.)
 
Last edited:

xStep

macrumors 68020
Jan 28, 2003
2,013
100
Less lost in L.A.
Interesting. For a user to 'like' your app, they REALLY have to like it. The hassle of logging into FB would discourage me from pressing 'like' buttons. :D

Meanwhile, I'm wondering how to encourage people to write a review of my app in the App Store. :( Maybe the 'like' button is easier for the user.
 

idelovski

macrumors regular
Sep 11, 2008
235
0
Interesting. For a user to 'like' your app, they REALLY have to like it. The hassle of logging into FB would discourage me from pressing 'like' buttons. :D
I can relate to that. I have the application that is used to grab photos from Facebook and I have noticed that users have trouble with the process of logging in. I can't speak for everybody that used my app - obviously - but a lot of people that were using it in front of me got confused doing it. If they have Facebook application on their iDevice, the process is somewhat simpler, but the fact that logging in and authorizing my application can vary from case to case makes it almost impossible for me to put simple instructions in my application.

Does anyone know of a good way how to describe this facebook logging thing? People hate reading long instructions, but I think I need to put at least few words about it.
 
Last edited:

xStep

macrumors 68020
Jan 28, 2003
2,013
100
Less lost in L.A.
Does anyone know of a good way hot to describe this facebook logging thing? People hate reading long instructions, but I think I need to put at least few words about it.
Just downloaded your app to see how the FB login works. I take it you are using their SDK? It brought up a window after I logged in. At the top right is an 'Install' button. I'm guessing I have to tap that to accept the app requirements. So, yea, confusing, even as a developer. I think that page could be better done.

Woa! Tapped that and got another screen regarding option permissions. Does the X mean I accept those or am blocking them. Not knowing, I clicked the 'Allow None'. I don't have a news feed as far as I know, and I don't see why the 'app' (yours on the iPod, or some background web app process) needs this.
 

idelovski

macrumors regular
Sep 11, 2008
235
0
Just downloaded your app to see how the FB login works. I take it you are using their SDK?
Yep!

It brought up a window after I logged in. At the top right is an 'Install' button.
Yes, this is the crazy part. My app already installed, so this button should scare off almost anyone. Nevertheless, you should tap it anyway.

Woa! Tapped that and got another screen regarding option permissions. Does the X mean I accept those or am blocking them. Not knowing, I clicked the 'Allow None'.
Bad move, I think. You should have allowed it. By any chance, can you get the images? I suppose not, but who knows...?!
 
Last edited:

idelovski

macrumors regular
Sep 11, 2008
235
0
I got images from FB. I didn't try the other services. I also got your images from Flickr via the bottom button in the About screen.
Strange. No wonder someone found the way to Zuckerberg's private images ;) And you reminded me I should update my Flickr album. It just sits there with only two images for almost three years now.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.