Post to Pinterest from an iOS app without leaving the app? - ios

I successfully integrated the Pinterest iOS SDK and can pin items, but it takes the user out of the app. Is there a way to do this but stay within the app?
I followed this guide already (How to integrate Pinterest in ios application)

The SDK provided by Pinterest only has the Pin it functionality, as described on their developer website. You cannot login with that SDK, but you can Pin images with it.you can login but can't get the response.
Pinterest has no official API for logging in, but they do use OAuth2 protocol. So you might have to write your own UIWebView handler that will allow the logging in. This will require research of OAuth2 protocol and storing cookies.
Check this GitHub project.
There is some more information in the following questions:
Log in with Pinterest
pinterest api documentation
may be this help you.

Yes you can pin items without leaving your app. It is mentioned in other answers, Pinterest has no official API. However their original web site using HTTP POST methods and you can do same thing programatically with using NSURLRequest and NSURLConnection or any other wrappers as like AFNetworking.
It is kinda hacky way but since they have no API this is the only way to do it. Only the downside, if they change something on their site code you should update your code regarding. I have released a OS X application couple months back, it is working fine since then.
I would like to write everything down here however it is almost complete application, this why I have prepared a sample app for you. If you decide to use this you have to tidy up the code little bit. You can download sample project from GitHub
How it works: Basically you have to login to Pinterest with using UIWebView, once you logged in UIWebView write cookies, we are going to use those cookies in HTTP headers to authenticate. (If you want to support social media logins you have to implement those separately)
Once we have the cookie, first thing first getting board list. -(void)getBoardList, then next step is choosing the board which you want to pin (you have to implement this, for now it show up 1st board in the list).
Pinning is two step operation here, At the first step you need to upload image to storage of Pinterest which -(IBAction)uploadImage:(id)sender method handles it. If image upload success it automatically call -(void)pinImage:(NSString *)imageURL to register your image to the selected board.
When you review the code you will see all variables hardcoded, you have to implement all of them as well. As I said this is at least gives you the idea how you can pin image to Pinterest. There is not error control in the code as well. while trying if you don't have any board, probably it will throw and error.

No, you cannot currently pin an item without leaving your app. The Pinterest API is pretty limited in my opinion. The only pinning functionality that they support for iOS is detailed in the iOS Pin It SDK, which is what you are already using.

Related

How to work with Firebase App Indexing for IOS Apps

i am in the process of making my app with firebase i am pretty much done with that except Firebase App Indexing. I am very exited with this feature because it could help me to increase my app get more traffic from the web but the problem is i really can't able to see how to implement this. According to Firebase Docs i just need to register my app with this pice of code
[[FIRAppIndexing sharedInstance] registerApp:your Apple ID from iTunes Connect];
I have done that but what should i do after that?
1.My app is firebase app that means i don't have any website to host my content except firebase realtime database. Does my content is available for crawlers? if not how can i make available to them?
2.If i can able to show my content in the google search results i don't wanna show all the content and i wanna show just some of my content for example i have a social app for sharing General Knowledge questions, i wanna show just the question like "What is the highest mountain" in the search results and if the user want to see the answer it should take them to my app how can i do that?
3.As per docs i came to know that i need to create univiersal links for my app content to direct users from google search but how shold i do that ? Lets say should i crate universal links when the user create question?? if so how can i do that ??
Thank you very much for the help.
This is not currently possible on iOS using Firebase App Indexing. The situation is slightly different on Android, but that is not applicable to your question.
On iOS, Firebase App Indexing is simply highlighting pages on your website in Google search results that have corresponding content inside your app. This is achieved by piggybacking on Apple's Universal Links standard, and there is no proactive 'crawling' going on inside your app. This means unless you have a corresponding web page for your app with 1:1 content parity, you can't really benefit from Firebase App Indexing on iOS as it comes out-of-the-box.
The best workaround is to generate little 'placeholder pages' for every piece of content in your app, which the sole purpose of opening your app (if it is installed) or redirecting to the App Store (if it is not installed). Ideally you'll need some sort of deferred deep linking system so that users still see the correct content after downloading. Fun fact: this is essentially how HotelTonight operates their entire business model. Unfortunately Firebase's implementation is not mature enough to support this full flow, and Google hasn't quite figured out how to rank app-only content properly yet in search results so you will probably need to pro-actively submit your placeholder pages to them.
Shameless plug: at Branch, we provide all of the above as a free service. You can read more about it here and take a look at the set up docs here.

How do I use Facebook Login via Facebook App for iOS

I have a little problem. I am sing Facebook's API to get users information. I am using the code that provide here: https://github.com/pedro1993/ios-howtos
In those examples, when somebody logs in with Facebook they are taken to the Facebook app, whereas when in my app, Facebook is opened in a UIWebView. How can I stop that from happening and use the Facebook app?
Here is an example:
Peter
Follow this official tutorial instead https://developers.facebook.com/docs/facebook-login/ios/v2.0
Update Facebook SDK has several fallback behaviors to try before it falls back to in-app web view. You can debug it by setting breakpoints in corresponding places in code. From the look of it https://github.com/facebook/facebook-ios-sdk/blob/296771f5ed7674fcbed9c31cf39bf9c8e4706403/src/Login/FBSession.m#L1039 seems like a good place to start.
Especially try to debug -[FBSessionAppSwitchingLoginStategy tryPerformAuthorizeWithParams:session:logger:.

Facebook iOS sdk 3.10 share local image or movie

I used Facebook sdk in the past, but the new version is making me crazy. I'm trying to create a UIActivity subclass that calls the official facebook share dialog. Since for someone having the "via iOS" instead of the app name in the post is a first world problem (just kidding), I can't use the iOS native integration with the SLComposeViewController.
In the documentation it seems that for post a picture using the share dialogs you need to use open graph actions, but is not totally clear to me if you can do inside your app, or you need to rely on external php application.
I've seen that there are some common actions that wouldn't require a declaration of a new one, but posting a photo or a movie it doesn't seems to be there.
I'd like to use something "native" as a share dialog instead of an FBSession if possible.

iOS Facebook API/SDK Wrapper?

I've been looking for a good iOS Facebook API/SDK Wrapper, can't find any.
I need to be able to (with a few lines of code, not the insanely needed by Facebook's API):
Login user
Logout user
Get user's likes
Invite Friend to app
Maybe post to user's wall (this has been causing problems to other apps so not sure will actually implement)
Get user's friends
Get user's basic info (e-mail, name, etc.)
Is there any wrapper simplifying the absurd vanilla API?
https://developers.facebook.com/docs/reference/apis/
This should help and it is Facebook's official api.
Here's the documentation: https://developers.facebook.com/docs/ios/
You might be able to use portions of ShareKit for this (be sure to abide by their license): https://github.com/ShareKit/ShareKit/tree/master/Classes/ShareKit/Sharers/Services/Facebook
This doesn't do everything you asked, but it's a (clean) starting point at least: https://github.com/mobitar/Zuckerkit
This does a bit more, but hasn't been updated in a year: https://github.com/sinnerschrader-mobile/S2M-Facebook-iOS
I found this lib: https://github.com/lucascorrea/SCFacebook
It seems to use a not that outdated version of the iOS SDK (3.18 vs. current 3.21), is available on cocoapods and seems to cover many of your required API features.
I haven't used the lib my self, but i am considering it next time i have to develop an iOS App which needs to connect to facebook.

Facebook iOS SDK Pass parameter with app requests

I would like to have my native iOS app send a request with a parameter to a Facebook user on iOS. If they accept, it will launch my native iOS app and pass it the parameter. Is this possible?
I am having marginal success using [facebook dialog:#"apprequests" andParams:dict andDelegate:self]. I am getting the bookmark counter to increment on Facebook iOS app, but I do not see the individual requests. If I tap the bookmark it launches my app but I do not see how I can get the "data" parameter I passed with the request, or even the request_id.
On desktop I see the individual messages under "Requests" section of "Apps and Games". If I accept a request, I can see it pass the request_id to my (simple echo) canvas URL. I read this can be used to fetch the associated data. But, this does not help me on iOS. My app only runs on iOS, so this canvas app will eventually just be a "this app only works on iOS," but it seemed to be necessary to get the requests to flow.
Neither of these are showing me Notifications, so maybe I am doing something basic wrong. Or, is there some other way to pass a message to a Facebook user, with a URL they could click (to launch and feed my app its parameter).
One other odd thing, I do not see how to get rid of the Requests. If I "X" them on the desktop client, it asks me if I want to stop receiving all requests from my app, and if I say no, it only hides them temporarily.
Leif, Hi - I'm the engineer at Facebook who wrote the tutorial you've referenced.
I've taken a look at the issue you've mentioned - this is in fact not a bug in the documentation and is by design.
The incoming url from a request on iOS looks something like this:
fb480369938658210://authorize?expires_in=3600&access_token=BAAG05NeN86IBAC31YWMWRHVrNCAYMy0Rv1OtqZCwdH8QDBUAt5KgZCsIbU0EOZAvMms2tZCANV9sZBWSkEzStDtt4i7YnYZA4bPgGx2XaI5s22iBMxIZAneZAv7ADi3Wi20ZD&target_url=http%3A%2F%2Fm.facebook.com%2Fapps%2Ffriendsmashsample%3Ffb_source%3Dnotification%26request_ids%3D364209433669109%252C379616028785376%252C494409170593789%252C489782271042929%252C328564930575784%26ref%3Dnotif%26app_request_type%3Duser_to_user
This is bundling together several requests, with multiple request ids into a single url.
To get the extra data coupled with this request, it is not required to have the user_id. Hitting graph.facebook.com/*request_id* is enough.
You can actually see this outlined in the documentation here: https://developers.facebook.com/docs/requests/#deleting under the 'Request ID Format' heading.
The code contained in the Friendsmash sample and on the tutorial works correctly - I verified it just now. So it should serve as a good guide to the OP's question.
Thanks!
I have been struggling with this too.
First, the FB iOS SDK requests tutorial is a good start.
However, there are also a few bugs that makes things not work as expected:
It seems that currently, a mobile web url has to be set up for the FB app in order for requestIds to be forwarded from the native FB app to your native app. See this bug report.
The tutorial mentioned above uses an erroneous graph path for the request object. I uses "request-id" where it should be "request-id"_"user-id". I have filed a documentation bug report on that issue.

Resources