How can I display face book feeds related to a group on an iOS App?
Is there any JSON/JSONP call to fetch the feeds??
Any help is Appreciated.
The simplest - is just to show a web page on web view. Facebook manages itself to fit the width of your webView control.
// Load facebook data
NSString *fbUrlAddress = #"http://www.facebook.com/FLORtiles"; // here you put your own group
//Create a URL object.
NSURL *fbUrl = [NSURL URLWithString:fbUrlAddress];
NSString *webHTMLfb = [NSString stringWithContentsOfURL:fbUrl encoding:NSUTF8StringEncoding error:NULL];
//NSLog(#"webHTML of facebook: %#", webHTMLfb);
//URL Requst Object
NSURLRequest *fbRequestObj = [NSURLRequest requestWithURL:fbUrl];
//Load the request in the UIWebView.
[fbWebView loadRequest:fbRequestObj];
You might need to get familiar with Facebook's Graph Api
Go through this -> https://developers.facebook.com/docs/mobile/ios/build/
Related
I am implementing google plus sharing successfully by using the following lines of code. But after sharing it doesn't come back to initial screen. Is there any delegate call after completing the procedure of sharing
- (void)googelSharing{
//Set bool for Handler
[self setUserDefaultForSharing:NO];
GPPSignIn *signIn = [GPPSignIn sharedInstance];
signIn.clientID = kClientId;
signIn.scopes = #[#"https://www.googleapis.com/auth/plus.login"];
id<GPPShareBuilder> shareBuilder = [[GPPShare sharedInstance] shareDialog];
// This line will fill out the title, description, and thumbnail from
// the URL that you are sharing and includes a link to that URL.
[shareBuilder setURLToShare:[NSURL URLWithString:#"https://www.example.com/restaurant/sf/1234567/"]];
[shareBuilder open];
}
For your information Apple will reject the app if you use
a web page in mobile Safari for creating an account or logging in, then returns the user to the app.
See this discussion.
So Google release new Google Plus SDK for sign in
Google Sign In SDK 2.0 is documented on the new dev site :
https://developers.google.com/identity/sign-in/ios/
Hope this helps
It is not possible because when u request to open the specific web page iOS automatically transfer this request to Safari . And Safari will open that web page.
One thing you can do is used UIWebView in your app and open the web page inside UIWebView and u can easily get back to pervious viewController OR web page by adding simple UIButton in currentViewController class.
Here is code
UIWebView *webView = [[UIWebView alloc]init];
NSString *urlString = #"https://www.example.com/restaurant/sf/1234567/";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
[webView loadRequest:urlRequest];
[self.view addSubview:webView];
If u are used UIWebView than refer this answer it will help you Back Button on UIWebView
I am using iOS with parse.com and mailgun. I am trying to send an email with a pdf attached. I have read that the parse.com cloudCode doesn't allow attachments. But I have also seen this post, Mailgun: Sending image using parse cloud code ,saying instead of attaching place it inline.
First off, is this still the case, that we cannot send attachments via cloud code? If so, could someone give me a hand in figuring out how to get a pdf from my app into an email sent through mail gun? Im not using the built in mail view from apple because I need to be able to set the "from" address of the email.
I have the pdf created dynamically in the app and I present it in the code like this:
NSString* fileName = #"Invoice.PDF";
NSArray *arrayPaths =
NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory,
NSUserDomainMask,
YES);
NSString *path = [arrayPaths objectAtIndex:0];
NSString* pdfFileName = [path stringByAppendingPathComponent:fileName];
UIWebView* webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 60, 320, 480)];
NSURL *url = [NSURL fileURLWithPath:pdfFileName];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webView setScalesPageToFit:YES];
[webView loadRequest:request];
[self.view addSubview:webView];
I don't know how to get the file from the Docdir into the proper data form and either attached (if now possible) or place it inline like the post mentions above.
Any help would be appreciated. If you need more info, have questions or have alternate idea on how to accomplish this task please ask/suggest.
Thanks in advance
In my app i want to display the videos uploaded by a particular user in his Vimeo account.
I have completed the OAuth steps and got the video_id's of the video's uploaded by user. I tried to download the thumbnails for videos so that they can be displayed in table view or collection view.
Vimeo has provided the api method using that i got the response like this:
NSURL *url = [[NSURL alloc] initWithString:#"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.getThumbnailUrls&video_id=72961770"];
but i pasted the user id there. i tried another approach so that the user id is loaded dynamically.
NSURL *url = [[NSURL alloc] initWithString:#"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.getThumbnailUrls"];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc]initWithURL:url consumer:consumer token:token realm:nil signatureProvider:nil];
OARequestParameter *p0 = [[OARequestParameter alloc] initWithName:#"video_id" value:[array objectAtIndex:0]];
NSArray *params = [NSArray arrayWithObject:p0];
[request setParameters:params];
but i got an error saying that Msg = Method not found.
can you help me to get the id dynamically or is there a way to give the video_id as a parameter to the url. Thank you
create a string for url and paste until video_id=.
NSString *url = #"http://vimeo.com/api/rest/v2?format=json&method=vimeo.videos.getThumbnailUrls&video_id=";
and after that use stringByAppendingString method to append the video_id value to it and use it.
This is also not a direct way but somehow enables you to get the video thumbnails dynamically without having to paste it
I'm building an app that will access a specific user's YouTube uploads. For this, I'm using Google's GData Objective-C client library. I use it to get access to the user's uploads feed and return an NSArray of GDataEntryYouTubeVideos. Using GDataEntryYouTubeVideo's htmlLink method, I load the url into a UIWebView with some special HTML code. However, the UIWebView just shows a red page.
The url that htmlLink returns is an https. When I manually replace https with http, the video loads in the UIWebView as expected. The following code does not load the YouTube video:
- (void)viewDidLoad
{
[super viewDidLoad];
GDataServiceGoogleYouTube *youtubeService = [[GDataServiceGoogleYouTube alloc] init];
NSURL *uploadUrl = [GDataServiceGoogleYouTube youTubeURLForUserID:#"higaara" userFeedID:kGDataYouTubeUserFeedIDUploads];
void(^handler)(GDataServiceTicket *ticket, GDataFeedBase *feed, NSError *error) = ^(GDataServiceTicket *ticket, GDataFeedBase *feed, NSError *error)
{
NSLog(#"handler");
// Get the link from the youtube entry
GDataEntryYouTubeVideo *youTubeVideo = [feed firstEntry];
NSString *htmlLinkString = [[youTubeVideo HTMLLink] href];
// Create an html string to load into the web view
NSString *htmlString = [NSString stringWithFormat:#"<html><head><meta name =
\"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width =
212\"/></head><body style=\"background:#F00;margin-top:0px;margin-
left:0px\"><div><object width=\"212\" height=\"172\"><param name=\"movie\"
value=\"%#\"></param><param name=\"wmode\" value=\"transparent\"></param><embed
src=\"%#\"type=\"application/x-shockwave-flash\" wmode=\"transparent\"
width=\"212\" height=\"172\"></embed></object></div></body></html>",
htmlLinkString, htmlLinkString];
NSURL *tempurl = [NSURL URLWithString:#"http://onnati.net/apptrap"];
[webView loadHTMLString:htmlString tempurl];
};
[youtubeService fetchFeedWithURL:uploadUrl completionHandler:handler];
}
The html code in htmlString is from this blog post on YouTube's API blog.
If I replace the htmlLinkString creation line with this:
NSString *htmlLinkString = [[[youTubeVideo HTMLLink] href] stringByReplacingOccurrencesOfString:#"https://" withString:#"http://"];
then the UIWebView properly loads the video.
I'm not sure what I'm missing here. Do I need to do something more in order to load an https url into a UIWebView? Or is there something I'm missing in the GData library that returns a standard non-secure URL?
To hopefully close out this old question:
Some older versions of mobile Safari automatically translated YouTube Flash embeds into clickable thumbnails that would use an alternative playback mechanism, since iOS obviously doesn't support Flash. The logic to turn those embeds into clickable links probably has a hardcoded pattern that checks for http:// and not https:// URLs.
The recommended way to embed YouTube videos within an iOS UIWebView is using the iframe embed. You can obtain the video id from the Data API and then use that to construct the iframe URL.
I use the google maps API to trace the route between two points, my code is this :
NSString *urlString = [NSString stringWithFormat:#"https://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&hl=fr&output=embed&om=5",latUtilisateur,longUtilisateur,latStation,longStation];
//Create a URL object.
NSURL *url = [NSURL URLWithString:urlString];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
However, this didn't has the textual instructions feature. Am i missing some parameters in the request above or something else?
The output=embed parameter is resulting in the full screen map. You can try a couple of alternatives:
For the standard map/directions page.
http://maps.google.com/maps?saddr=Sydney&daddr=Brisbane&hl=fr&output=html&om=5
For a mobile friendly directions
page. This version includes links to
static maps for each step of the
journey.
http://maps.google.com/maps?saddr=Sydney&daddr=Brisbane&hl=fr&output=mobile&om=5