Facebook integration showing alert address is invalid - iphone

I am new in iPhone application development. Now i am developing application for iPhone In this application I need to upload video to Facebook. i am used below code. Now enter Facebook the user name and password. showing error message alert. like safari cannot open the page because the address is invalid.
- (void)viewDidLoad
{
facebook = [[Facebook alloc] initWithAppId:#"Facebook_App_Id"];
//#"com.facebook.samples.VideoUploadTest"];
facebook.sessionDelegate = self;
}
- (IBAction)buttonClicked:(id)sender {
NSArray* permissions = [[NSArray alloc] initWithObjects:
#"publish_stream", nil];
[facebook authorize:permissions delegate:self];
[permissions release];
}
- (void)fbDidLogin {
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"sample" ofType:#"mov"];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, #"video.mov",
#"video/quicktime", #"contentType",
#"Video Test Title", #"title",
#"Video Test Description", #"description",
nil];
[facebook requestWithGraphPath:#"me/videos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
referred from this url [http://developers.facebook.com/blog/post/532/]

Refer this for SSO settings.
http://developers.facebook.com/docs/mobile/ios/build/

Related

Facebook share passs link in app name

I want to pass a link in App Name for example if user click on text via (App Name) then it navigate some specific url
If anybody can help my code is here:
Facebook *fb = [[Facebook alloc] initWithAppId:FB_ID andDelegate:self];
NSString *strUrl = [dicItemDetails valueForKey:#"imgurl"];
if ([strUrl length] == 0) {
strUrl = [[temp objectAtIndex:0] valueForKey:#"logourl"];
}
NSMutableDictionary *d = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
[dicItemDetails valueForKey:#"menuItemName"], #"name"
, strCaption,#"description"
, strUrl, #"picture"
, [[temp objectAtIndex:0] valueForKey:#"facebook"], #"link"
, nil];
[fb dialog:#"feed" andParams:d andDelegate:self];
you can post two link with your Message posting in facebook time line like bellow way:-
-(void)fbNewuserWallpost
{
SBJSON *jsonWriter = [[SBJSON new] autorelease];
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
#"AppName",#"name",self.FirstLinkString,#"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"yourAppID",#"app_id",
#"AppName", #"name",
captonString, #"caption",
#"yourDiscription", #"description",
self.secondLinkString, #"link",
#"ImageURL", #"picture",
actionLinksStr, #"actions",
nil];
[[AppDelegate facebook] requestWithGraphPath:#"me/feed" andParams:params andHttpMethod:#"POST" andDelegate:self];
}

Share image from bundle and link on Facebook in iphone

I want to share image,link etc to Facebook from my iphone app.My app Link,cation,name and description posted successfully. But i can't share image. Please follow my code..
UIImage *image = [UIImage imageNamed:#"sample.png"];
NSData *imgData = UIImageJPEGRepresentation(image, 1.0);
self.dictionary =[[NSMutableDictionary alloc] initWithObjectsAndKeys: #"https://www.google.com/ios", #"link",
imgData, #"data",
#"AppName", #"name",
#"Testing", #"caption",
#"say something about this", #"description",
nil];
my share facebook code is..
[facebook requestWithGraphPath:#"/me/feed" andParams:dictionary andHttpMethod:#"POST" andDelegate:self];
My problem is how to take image from bundle and how to share selected image to Facebook?Please help me..
use like below:
NSString *filePath = [[NSBundle mainBundle] pathForResource:#"image1" ofType:#"png"];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"My hat image", #"message", data, #"source", nil];
[facebook requestWithGraphPath:#"/me/photos" andParams:params andHttpMethod:#"POST" andDelegate:self];

How to cancel a video upload in progress using the Facebook iOS SDK?

I'm using the Facebook iOS SDK to post videos from my app to the user's facebook.
I'm trying to allow the user to cancel the upload after the upload has started.
These are the methods that starts the upload:
- (void)startUpload
{
NSArray* permissions = [[NSArray alloc] initWithObjects:
#"publish_stream", nil];
[facebook authorize:permissions];
[permissions release];
}
- (void)fbDidLogin
{
NSString *filePath = [videoNSURL path];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
videoData, #"video.mov",
#"video/quicktime", #"contentType",
videoTitle, #"title",
videoDescription, #"description",
nil];
[facebook requestWithGraphPath:#"me/videos"
andParams:params
andHttpMethod:#"POST"
andDelegate:self];
}
I cannot find any methods inside Facebook.h that comes with the Facebook iOS SDK that allows me to cancel the upload.
Even if I do a [facebook release], it will still not cancel the FBSession which is trying to upload the video. Which means I'll get a exc_bad_access when the upload is complete when FBSession tries to inform the facebook object that the upload is complete.
I added the following methods:
FBRequest
(void) cancel {
[_connection cancel];
[_connection release], _connection = nil;
}
Facebook
(void)cancelPendingRequest {
[_request cancel];
[_request release], _request = nil;
}
cancelPendingRequest will allow me to cancel a video upload in progress.

iPhone - A problem with uploading video to facebook

I am having a problem uploading a video to facebook.
Last month, it worked OK.
I can still log in to FaceBook with my appKey and appSecretKey, but if I request 'facebook.video.upload' method to facebook, the site does not reply.
In the past, it worked perfectly.
What is the problem? Has FaceBook updated the interface?
Thanks!
For me I use FBVideoUpload (source code here) and it works fine, so I put my code here:
m_Facebook = [[Facebook alloc] init];
m_FacebookUploader = [[FBVideoUpload alloc]init];
NSArray *permissions = [NSArray arrayWithObjects:#"publish_stream", #"offline_access",nil];
m_Facebook.forceOldStyleAuth = YES;
[m_Facebook authorize:APP_ID permissions:permissions delegate:self];
In Facebook delegate methods
- (void)fbDidLogin
{
NSURL *movieURL = [NSURL fileURLWithPath:m_MoviePath];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
#"Look at my funny video !", #"title",
#"A message", #"description",
nil];
[m_FacebookUploader setApiKey:APP_ID];
[m_FacebookUploader setAccessToken:m_Facebook.accessToken];
[m_FacebookUploader setAppSecret:APP_SECRET];
[m_FacebookUploader startUploadWithURL:movieURL params:params delegate:self];
}

How to post to facebook from iPhone using publish.stream without the Facebook dialog method

I would simply like to use publish.stream to post to Facebook from an iPhone app but without using the UIWebview that pops up when you call the Facebook object's dialog method. How do I do this?
SBJSON *jsonWriter = [[SBJSON alloc] init]; NSDictionary *attchmentDic = [NSDictionary dictionaryWithObjectsAndKeys:
#"Foobar",#"name",
nil]; NSString *attachmentStr = [jsonWriter stringWithObject:attchmentDic]; NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
#"Bla-bla",#"message",
attachmentStr, #"attachment",
nil];
[_facebook requestWithMethodName:#"stream.publish"
andParams:params
andHttpMethod:#"POST"
andDelegate:self]; [jsonWriter release];