How to post on a business page's 'visitor posts' through my app using Swift - swift

I'm writing an iOS app for a business using the latest version of Swift and Xcode. One of the requirements is to allow the user of the app to post through the app to the business's Facebook page, specifically to the Visitor Posts section.
I've already installed Cocoapods and set up my pod file to include the various Facebook entities, like Facebook login. But I'm at a loss for how to proceed further.
I couldn't find many examples of just posting to a Facebook page, but the ones I did find are confusing as they say they are for Swift development, but include a lot of objective C. Can anyone point me to documentation on how to post a line of text to the 'Visitors Posts' section of a page using Swift?

Related

Facebook FBConnect and FeedDialog working when Open Graph v1.0 retired?

I have an app that controls simple Facebook URL sharing using FBConnect (and therefore FeedDialog). It is used because it does not require the user to be logged in, unlike the native sheet.
Will the forthcoming retirement of v1.0 mean that FBConnect no longer works? The only reference I can see to V1.0 or V2.x is when the username and password authenticates. , prior to sending the URL link. The documentation seems to suggest that FeedDialog is deprecated and may still work but it isn't entirely clear (and does not mention FBConnect).
FBConnect as you have described has been phased out for a long time. Facebook has transitioned to the Feed Dialog (now being deprecated) and now to the Share Dialog.
It appears based on your use case that the dialog that you should investigate using is the Share Dialog. This does not require you to have users log in to Facebook and provides all the functionality to share your URL's across the devices you use.
The documentation with complete code samples for this is located here with subsequent documentation for implementing on iOS and Android.
https://developers.facebook.com/docs/sharing/reference/share-dialog
This will allow you to share you website URL on all platforms and allowing you to customize which images are shared with the url's and help format how they are displayed on the news feed.

Facebook app id for website social plugins

I have like/share buttons on my website and am not currently using an appid. Finding information on whether this is a necessity for the above configuration is difficult to confirm. When going through the Facebook app "create" forms, I'm really confused by a lot of the requirements as it seems to be more focused around actual apps rather than websites, which login via fb etc.
In the past I have created an app for one of my other websites and I don't believe there was any verification/submission process at this point (about 2-3 years ago). Reviewing my old app configuration now I can see that it is not "live" - does anyone know whether Facebook implemented this submission process in the last couple of years, and then de-activated any live apps that were created prior to this?
I now want to setup a new app for my new website and I'm unsure what the different 'action types' mean and what I would need to simply use like/share buttons on the website. Could someone give me a quick run down of what I'd need and what they are?
Any other info/tips people can provide would be greatly appreciated. I'm finding that the like/share DO still work without the app, but sometimes the share button doesn't work properly (I have a feeling this is something to do with the app).
Thanks
If you are just using the Social Plugins, you don't need to have a Facebook App ID.
If you want more integration, it will be required. Creating an App ID is like registering your App, wether an iOS or Android App or just a website, so that you can make Graph API calls for it.
The easiest way to register your website is to go the quickstart: https://developers.facebook.com/quickstarts/?platform=web (or https://developers.facebook.com/apps). There you can type a name and follow the steps.
You can then follow the "Sharing best practices" (https://developers.facebook.com/docs/sharing/best-practices#tags) on how to use the App ID. For example, by including an fb:app_id meta tag on your pages.
There is a review process, since last April, but that is only needed if you use permissions for your App. If you just use the plugins, that is not needed.
Can you explain more what is exactly not working?
Update
The time you create a page the Facebook crawler does not know yet what the Opengraph data for that one is. This will happen after the first share, but if you want to ensure it is correct from the first share on, you can force a re-scrape.
This section explains how that works:
https://developers.facebook.com/docs/sharing/opengraph/using-objects#update
When an app triggers a scrape using an API endpoint This Graph API
endpoint is simply a call to:
POST /?id={object-instance-id or object-url}&scrape=true

Whats the difference between Facebook Feed Dialog and (Sharer)

I'm using a plugin called FooBox for wordpress that puts share buttons on top of images within a Pop-Over.
Within the settings of this plugin is an option to:
Enable Facebook's new feed dialog way of sharing, rather than their old (and deprecated!) sharer.
Please note that this method requires a Facebook App Id in order to function!
I'm not exactly a developer... so I cannot determine what this means, if its better, how so..
Could someone explain in laymen terms what this is?
Thank you
The old sharer method is no longer deprecated, as Facebook have recently updated it (and removed the deprecated notice that was on their site for ages). Both methods have pros and cons. This is my understanding:
FaceBook Sharer
Easy to implement and no facebook app id needed in order to setup
Can share to personal timeline as well as other facebook pages you are admin for
Sharer recently was updated (Feb/Mar 2014) and no longer accepts custom images and overrides anything you pass it with the image opengraph tags used on the page you are linking to. This is a major problem when used with lightbox solutions like FooBox, because the specific image that is shared no longer gets recognized by facebook.
Feed Dialog
More involved to setup and get working. An app ID is required and the app ID cannot be shared across domains.
It only allows you to share to your personal timeline. No support for sharing to pages that you are an admin for.
It accepts custom images, so FooBox works and the specific image that is shared is the image that is shown in the user's timeline.
I am the developer of FooBox and will be updating the plugin soon with an updated explanation to help users on learning what the difference is.
And since Facebook have removed support for custom images since Mar 2014, we will no longer recommend the sharer, but rather push the feed dialog.
More Info
Facebook documentation page on the sharer. (further down the page under the FAQ section and hardly mentioned)
Facebook documentation page on the feed dialog.
Response from facebook about no longer supporting the custom image for the sharer.

Ability to tag friends in a facebook native share dialogue

I am using the Facebook iOS SDK 3.1 in my latest, and I'm using the native share dialogue from FBNativeDialogue.
It has a "friends" button in the corner, which I always throught was to tag friends (just like the location button tags the location), but I realised that this is privacy settings for the post.
Therefor, Im still confounded how you can tag friends in a post. Nothing seems to happend when i type # followed by my friends names, is this not implemented yet ? And does anyone know of clever way to implement this ?
What the customer wants is the similar to the "Who are you with?" button as shown here:
I just don't think this is possible, considering the current Facebook SDK (3.5.1) documentation -- https://developers.facebook.com/docs/howtos/ios-6/#nativepostcontroller. It states:
iOS 6 includes a native Share Sheet that lets users post status updates, photos, links, and locations to Facebook and includes support for setting the audience for the post and tagging the post with a location.
Even when you post something on Facebook from iOS' Notification Center, it only allows you to share the information mentioned above, without tagging friends.
Instead, you could use the Facebook views, as they do here https://developers.facebook.com/docs/tutorials/ios-sdk-tutorial/show-friends/. But if you have to use the Native Dialogs, I can't see a way. If you get it to work, please let us know the solution.

How to setup Facebook Timeline Cover Photo auto upload in website?

I am new to Facebook API and app development. I am trying to build a facebook timeline cover website where users can auto upload and publish the cover to a new album created in the website/app name. Then they would be redirected to another page on my website with instructions on how to setup the cover on their profile timeline. Most profile cover websites are using the same method such as myfbcovers.com, facebookprofilecovers.com, profilephotocovers.com, facebook.coversdaddy.com, fbcoverlover.com and newfbcovers.com to name a few. I have been searching the facebook developer pages and several tutorials over the net. Some tutorials I checked are:
http://thinkdiff.net/facebook/graph-api-iframe-base-facebook-application-development/
http://daipratt.co.uk/facebook-api-upload-photo/
http://developers.facebook.com/blog/post/498/
And also several youtube videos.
But there are several confusions I have about the app. Sorry for the questions if they are too basic as I am a complete newbie who is willing to learn. One of the main problems is that most of the tutorials are outdated as the facebook app creation page etc. Now is different and there is no callback url etc. or canvas etc. in options now which are used in the tutorials. In the tutorials, it is mentioned that for creating a website app or facebook app for page, I need a callback URL which I cannot see now. Secondly, if it is mentioned in those tutorials that I need SSL in my website for an app but none of the facebook cover websites listed above have SSL it seems. I also do not have SSL on my server. So, not sure if that is needed and if an app is needed at all on my local server. And all the apps are doing things different such as I can see these URLs on clicking on some of the clickable links for uploading the cover button. Here are a few examples:
http://facebookprofilecovers.com/wp-content/themes/fbcovers/fb/?i=http%3A%2F%2Ffacebookprofilecovers.com%2Fwp-content%2Fuploads%2FHappily-Married-Facebook-Timeline-Cover.png
http://freetimelinecovers.net/facebook/?cov_img=/images/sports-covers/manchester-united.jpg
Some have direct link to the facebook app page such as:
http://apps.facebook.com/profilephotocovers/index.php?id=35 broken link
And only one website seems to have the publish_stream etc. in the url itself
https://facebook.com/dialog/oauth?client_id=162046520556852&redirect_uri=http%3A%2F%2Ffacebook.coversdaddy.com%2Fi-m-not-a-monster-1242.html&state=e4abcdc1d9288be8233a7ac4aa243997&scope=user_photos%2Cpublish_stream
On checking through Live HTTP header, it seems all websites are following a similar pattern which is directly used in the URL in the last website. For example, here are a few steps of the other websites I saw while checking with Live HTTP header.
https://graph.facebook.com/oauth/authorize?client_id=112308188876405&redirect_uri=http://www.myfbcovers.com/oauth/callback&scope=publish_stream,user_photos,email
https://facebook.com/dialog/oauth?client_id=237897089598589&redirect_uri=http%3A%2F%2Ffacebookprofilecovers.com%2Fwp-content%2Fthemes%2Ffbcovers%2Ffb%2Findex.php&state=0ca1581f006bdd80bd5da78e95179f3a&scope=publish_stream
And so on.
I could also notice that almost all websites were taking auth for only publish_stream and nothing else. Only myfbcovers.com is an exception which also asks for user_photos and email. Rest are not asking for the same and so perhaps publish_stream is the only permission needed.
So, to create the app is there any tutorial. And do I need to host the app on my own server in a sub directory of the website or does it make direct call to facebook. The reason I am asking is because it seems Facebook apps if hosted on local server needs SSL mandatory whereas none of the above websites have SSL/https. And if I do not need to host the app on my own server then how can I make the photo upload link to facebook and then return back to the website for the rest of the instructions. I am using Wordpress on my website like most of the other sites are doing and so, that should not be a problem I suppose. Any help would be highly appreciated. I am willing to learn properly and some good tutorials for creating the photo album and then uploading the photo to the user's album etc. would be fine too if not with the full code. Any help would be highly appreciated.
NOTE: I have removed the HTTP and WWW part in many of the above URLs as I can only post a maximum of two links being a new user. Please add them if needed in those where they are not present.
Ok, I did not install all the applications above to see exactly what they did. I think your question is long... but pretty straight forward. This is what I understand your question to be :
You would like to create a cover photo generator that will allow users to customize their cover photo by uploading files, maybe doing some editing to them. Also maybe using templates of cool ideas and in the end being able to update their cool new cover photo directly into their profile.
This is not very complicated to do although to this date there is no real documentation (by facebook) about how to dynamically update the cover photo. However there are ways of creating photo albums and uploading photos to there.
If you are planning to make your application run with in facebook - that means use the apps.facebook.com/your_app_name, and have canvas or tab URLS, then you will have to purchase an SSL certificate.
Finnaly, in order to get as close to the functionality your want, you might have to make some sacrifices (becuase changing the cover photo is not possible yet with the Graph API).
To locate the cover photo album you'll have to manually scan through all the users albums names - and for that you'll need the user_photos permission.
Once you have created the photo you want, you could possibly let the user upload it (publish_stream permission needed for this) to a different album, and then give the user some detailed instructions using screen shots and direct them exactly how to change their cover photo.
I recommend you read through the Authentication documentation decide what permissions you need (such as user_photos for the users photos and publish_stream for uploading a new picture or creating an album.)
In addition, there are many many tutorials on the Official Facebook Documentation Pages and their Developers Blog- check them out before going onto other sites that have written their own tutorials. Facebook does update their API quite a bit - but they also (recently) have been pretty good on updating their documentation to mirror the changes to the API...
As serious developers using a 3rd party API (
Graph API ), it is solely our responsibility to keep up to date with changes and to write code and applications that comply with their platform policies.